2 Commits a046d27686 ... 8437ed536d

Auteur SHA1 Message Date
  sunhaonan 8437ed536d Merge branch 'compdfkit_demo_win_rebuild' of http://git.kdan.cc:8865/Others/kmpdfkit_demo into compdfkit_demo_win_rebuild il y a 11 mois
  sunhaonan 9038c1cf4c 其他 - 使用滚轮缩放时更新显示 il y a 11 mois

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

@@ -2,6 +2,7 @@
 using System;
 using System.Windows;
 using System.Windows.Controls;
+using System.Windows.Input;
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -19,12 +20,22 @@ namespace Compdfkit_Tools.PDFControl
             ViewControl = viewControl;
         }
 
+        private void PDFControl_MouseWheelZoomHandler(object sender, ComPDFKitViewer.MouseWheelZoomArgs e)
+        {
+            if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
+            {
+                CPDFViewer pdfViewer = ViewControl.PDFViewTool.GetCPDFViewer();
+                SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewer.GetZoom() * 100)));
+            }
+        }
+
         private void PDFScalingControl_Loaded(object sender, RoutedEventArgs e)
         {
             CPDFScalingUI.SetScaleEvent += PDFScalingControl_SetScaleEvent;
             CPDFScalingUI.ScaleIncreaseEvent += PDFScalingControl_ScaleIncreaseEvent;
             CPDFScalingUI.ScaleDecreaseEvent += PDFScalingControl_ScaleDecreaseEvent;
             CPDFScalingUI.SetPresetScaleEvent += CPDFScalingUI_SetPresetScaleEvent;
+            ViewControl.PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler += PDFControl_MouseWheelZoomHandler;
         }
 
         private void CPDFScalingUI_Unloaded(object sender, RoutedEventArgs e)
@@ -33,6 +44,7 @@ namespace Compdfkit_Tools.PDFControl
             CPDFScalingUI.ScaleIncreaseEvent -= PDFScalingControl_ScaleIncreaseEvent;
             CPDFScalingUI.ScaleDecreaseEvent -= PDFScalingControl_ScaleDecreaseEvent;
             CPDFScalingUI.SetPresetScaleEvent -= CPDFScalingUI_SetPresetScaleEvent;
+            ViewControl.PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler -= PDFControl_MouseWheelZoomHandler;
         }
 
         private void PDFScalingControl_ScaleDecreaseEvent(object sender, EventArgs e)