ソースを参照

其他 - 缩放系数处理

zhuyi 1 年間 前
コミット
ba6f4d0baa

+ 5 - 0
Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs

@@ -256,6 +256,7 @@ namespace Compdfkit_Tools.PDFControl
             if (PdfViewControl != null && PdfViewControl.PDFViewTool != null)
             {
                 PdfViewControl.PDFViewTool.GetCPDFViewer()?.UndoManager?.Undo();
+                PdfViewControl.PDFViewTool.GetCPDFViewer().UpDataRenderFrame();
             }
         }
 
@@ -264,6 +265,7 @@ namespace Compdfkit_Tools.PDFControl
             if (PdfViewControl != null && PdfViewControl.PDFViewTool != null)
             {
                 PdfViewControl.PDFViewTool.GetCPDFViewer()?.UndoManager?.Redo();
+                PdfViewControl.PDFViewTool.GetCPDFViewer().UpDataRenderFrame();
             }
         }
 
@@ -302,6 +304,8 @@ namespace Compdfkit_Tools.PDFControl
 
         public void InitWithPDFViewer(PDFViewControl view)
         {
+            PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
             PdfViewControl = view;
             PDFGrid.Child = PdfViewControl;
             FloatPageTool.InitWithPDFViewer(view);
@@ -309,6 +313,7 @@ namespace Compdfkit_Tools.PDFControl
             DataContext = this;
         }
 
+
         /// <summary>
         /// Text and Image Selected Event
         /// </summary>

+ 1 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFScaling/PDFScalingControl/CPDFScalingControl.xaml.cs

@@ -137,6 +137,7 @@ namespace Compdfkit_Tools.PDFControl
                 pdfViewer.SetZoom(double.Parse(e) / 100);
             }
             SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewer.GetZoom() * 100)));
+            pdfViewer.UpDataRenderFrame();
         }
 
         public void SetZoomTextBoxText(string value)

+ 15 - 5
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs

@@ -14,8 +14,9 @@ namespace Compdfkit_Tools.PDFControl
 {
     public partial class PDFViewControl : UserControl
     {
-        static CPDFViewerTool ViewerTool = new CPDFViewerTool();
-        public CPDFToolManager PDFToolManager;
+        static CPDFViewerTool ViewerTool = null;
+        static CPDFToolManager pDFToolManager = null;
+        public CPDFToolManager PDFToolManager = null;
         #region Properties
         public CPDFViewerTool PDFViewTool { get; set; }
 
@@ -29,15 +30,24 @@ namespace Compdfkit_Tools.PDFControl
             if (ViewerTool==null)
             {
                 PDFViewTool = ViewerTool= new CPDFViewerTool();
+                PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler += PDFViewControl_MouseWheelZoomHandler;
+                PDFViewTool.SizeChanged += PDFViewTool_SizeChanged;
+                if (pDFToolManager == null)
+                {
+                    PDFToolManager= pDFToolManager = new CPDFToolManager(PDFViewTool);
+                }
+                else
+                {
+                    pDFToolManager.Remove();
+                    PDFToolManager= pDFToolManager = new CPDFToolManager(PDFViewTool);
+                }
             }
             else
             {
                 PDFViewTool = ViewerTool;
+                PDFToolManager = pDFToolManager;
             }
             Content = PDFViewTool;
-            PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler += PDFViewControl_MouseWheelZoomHandler;
-            PDFViewTool.SizeChanged += PDFViewTool_SizeChanged;
-            PDFToolManager = new CPDFToolManager(PDFViewTool);
             //PDFToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
         }