2 Commity a046d27686 ... 8437ed536d

Autor SHA1 Wiadomość Data
  sunhaonan 8437ed536d Merge branch 'compdfkit_demo_win_rebuild' of http://git.kdan.cc:8865/Others/kmpdfkit_demo into compdfkit_demo_win_rebuild 11 miesięcy temu
  sunhaonan 9038c1cf4c 其他 - 使用滚轮缩放时更新显示 11 miesięcy temu

+ 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)