Procházet zdrojové kódy

注释-音频注释相关UI调整

zhuyi před 10 měsíci
rodič
revize
b6c04bb0d0

+ 25 - 15
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs

@@ -25,6 +25,7 @@ using System.Text;
 using ComPDFKitViewer.Helper;
 using ComPDFKit.Viewer.Helper;
 using System.Drawing.Imaging;
+using System.Reflection;
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -636,7 +637,7 @@ namespace Compdfkit_Tools.PDFControl
                     DrawingVisual copyVisual = new DrawingVisual();
                     DrawingContext copyContext = copyVisual.RenderOpen();
 
-                   Color color= ParamConverter.ConverterByteForColor(inkParam.InkColor);
+                    Color color = ParamConverter.ConverterByteForColor(inkParam.InkColor);
                     color.A = inkParam.Transparency;
                     Pen drawPen = new Pen(new SolidColorBrush(color), inkParam.Thickness);
                     copyContext?.DrawGeometry(null, drawPen, PaintGeomtry);
@@ -908,20 +909,29 @@ namespace Compdfkit_Tools.PDFControl
                     annotationPanel = pdfLinkUI;
                     break;
                 case CPDFAnnotationType.Audio:
-                    //SoundAnnotArgs soundArgs = new SoundAnnotArgs();
-                    //OpenFileDialog openAudioDialog = new OpenFileDialog();
-                    //openAudioDialog.Filter = "Wave Files(*.wav)|*.wav|All Files(*.*;)|*.*;";
-                    //if (openAudioDialog.ShowDialog() == true)
-                    //{
-                    //    soundArgs.SoundFilePath = openAudioDialog.FileName;
-                    //    this.pdfViewerControl.SetMouseMode(MouseModes.AnnotCreate);
-                    //    pdfViewerControl.SetToolParam(soundArgs);
-                    //}
-                    //else
-                    //{
-                    //    this.pdfViewerControl.SetMouseMode(MouseModes.PanTool);
-                    //    ClearAnnotationBar?.Invoke(this, EventArgs.Empty);
-                    //}
+                    SoundParam soundParam = new SoundParam();
+                    soundParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_SOUND;
+                    OpenFileDialog openAudioDialog = new OpenFileDialog();
+                    openAudioDialog.Filter = "Wave Files(*.wav)|*.wav|All Files(*.*;)|*.*;";
+                    if (openAudioDialog.ShowDialog() == true)
+                    {
+                        BitmapImage img = new BitmapImage(new Uri("pack://application:,,,/Compdfkit_Tools;component/Asset/Resource/SoundAnnot.png"));
+                        PngBitmapEncoder encoder = new PngBitmapEncoder();
+                        encoder.Frames.Add(BitmapFrame.Create(img));
+                        MemoryStream memoryStream = new MemoryStream();
+                        encoder.Save(memoryStream);
+
+                        soundParam.ImageStream = memoryStream;
+                        soundParam.SoundFilePath = openAudioDialog.FileName;
+                        pdfViewerControl.SetToolType(ToolType.CreateAnnot);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_SOUND);
+                        pdfViewerControl.SetAnnotParam(soundParam);
+                    }
+                    else
+                    {
+                        pdfViewerControl.SetToolType(ToolType.Pan);
+                        ClearAnnotationBar?.Invoke(this, EventArgs.Empty);
+                    }
                     ClearPanel();
                     break;
                 case CPDFAnnotationType.Image:

binární
Demo/Examples/Compdfkit_Tools/Asset/Resource/SoundAnnot.png


+ 3 - 1
Demo/Examples/Compdfkit_Tools/Compdfkit_Tools.csproj

@@ -676,6 +676,7 @@
     <Resource Include="Asset\Resource\warn.png" />
     <Resource Include="ComPDFKit_Logo.ico" />
     <Resource Include="Asset\Resource\Logo.png" />
+    <Resource Include="Asset\Resource\SoundAnnot.png" />
     <Content Include="VirtualizingWrapPanel.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -1223,5 +1224,6 @@
       <Project>{56E518AD-C126-4B48-9A09-0A64C87020E4}</Project>
       <Name>ComPDFKit.Desk</Name>
     </ProjectReference>
-  </ItemGroup>  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs

@@ -163,7 +163,7 @@ namespace Compdfkit_Tools.Edit
             if (imageArea != null)
             {
                 Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
-                if (imageArea.Rotate((float)e))
+                if (imageArea.Rotate((int)e))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
                     editHistory.EditPage = editPage;

+ 1 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs

@@ -237,7 +237,6 @@ namespace Compdfkit_Tools.PDFControl
                         ViewToolGrid.ColumnDefinitions[1].Width = new GridLength(15, GridUnitType.Auto);
                         ViewToolGrid.ColumnDefinitions[2].Width = new GridLength(ViewToolGrid.ActualWidth / 2);
                         VerticalView.Child = splitViewerTool;
-
                     }
                     break;
                 case SplitMode.Horizontal:
@@ -280,6 +279,7 @@ namespace Compdfkit_Tools.PDFControl
             splitViewerTool?.GetCPDFViewer()?.UpDateRenderFrame();
 
         }
+
         public void SetToolType(ToolType type)
         {
             toolManager?.SetToolType(type);