ソースを参照

splitview - 图片,图章实现,刷新完善

sunhaonan 11 ヶ月 前
コミット
d4daf26ac0
21 ファイル変更252 行追加261 行削除
  1. 2 6
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs
  2. 58 24
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs
  3. 9 36
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreeTextUI.xaml.cs
  4. 4 4
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreehandUI.xaml.cs
  5. 3 6
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFMarkupUI.xaml.cs
  6. 2 4
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFNoteUI.xaml.cs
  7. 7 14
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFShapeUI.xaml.cs
  8. 1 2
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFSignatureUI.xaml.cs
  9. 1 5
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFTempStampUI.xaml.cs
  10. 6 14
      Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml.cs
  11. 7 7
      Demo/Examples/Compdfkit_Tools/Form/Property/CheckBoxProperty.xaml.cs
  12. 10 10
      Demo/Examples/Compdfkit_Tools/Form/Property/ComboBoxProperty.xaml.cs
  13. 10 10
      Demo/Examples/Compdfkit_Tools/Form/Property/ListBoxProperty.xaml.cs
  14. 10 10
      Demo/Examples/Compdfkit_Tools/Form/Property/PushButtonProperty.xaml.cs
  15. 7 7
      Demo/Examples/Compdfkit_Tools/Form/Property/RadioButtonProperty.xaml.cs
  16. 1 1
      Demo/Examples/Compdfkit_Tools/Form/Property/SignatureProperty.xaml.cs
  17. 12 12
      Demo/Examples/Compdfkit_Tools/Form/Property/TextFieldProperty.xaml.cs
  18. 2 2
      Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs
  19. 100 72
      Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs
  20. 0 8
      Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml.cs
  21. 0 7
      Demo/Examples/PDFViewer/MainPage.xaml.cs

+ 2 - 6
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs

@@ -16,6 +16,7 @@ using Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI;
 using Compdfkit_Tools.Helper;
 using ComPDFKit.DigitalSign;
 using ComPDFKit.PDFAnnotation.Form;
+using ComPDFKit.PDFAnnotation;
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -106,16 +107,10 @@ namespace Compdfkit_Tools.PDFControl
         {
             PDFViewControl = pdfViewer;
             PDFGrid.Child = PDFViewControl;
-            PDFViewControl.SplitPDFViewToolCreated -= PDFViewControl_SplitPDFViewToolCreated;
-            PDFViewControl.SplitPDFViewToolCreated += PDFViewControl_SplitPDFViewToolCreated;
             FloatPageTool.InitWithPDFViewer(PDFViewControl);
             InitialPDFViewControl(PDFViewControl);
         }
 
-        private void PDFViewControl_SplitPDFViewToolCreated(object sender, EventArgs e)
-        {
-            PDFAnnotationControl.SetPDFViewer(PDFViewControl);
-        }
         #endregion
 
         #region Public Method
@@ -126,6 +121,7 @@ namespace Compdfkit_Tools.PDFControl
             BotaContainer.Child = null;
             PropertyContainer.Child = null;
             displaySettingsControl = null;
+            PDFViewControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_NONE);
         }
         
         public void SetBOTAContainer(CPDFBOTABarControl botaControl)

+ 58 - 24
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs

@@ -24,6 +24,7 @@ using ComPDFKit.PDFDocument;
 using System.Text;
 using ComPDFKitViewer.Helper;
 using ComPDFKit.Viewer.Helper;
+using System.Drawing.Imaging;
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -75,14 +76,24 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (this.pdfViewerControl != null)
             {
-                pdfViewerControl.PDFToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
-                pdfViewerControl.PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
+                pdfViewerControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
+                pdfViewerControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
+                pdfViewerControl.MouseLeftButtonUpHandler -= PdfViewerControl_MouseLeftButtonUp;
+                pdfViewerControl.MouseLeftButtonUpHandler += PdfViewerControl_MouseLeftButtonUp;
                 //this.pdfViewerControl.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
                 //this.pdfViewerControl.AnnotEditHandler -= PdfViewer_AnnotEditHandler;
                 //this.pdfViewerControl.AnnotEditHandler += PdfViewer_AnnotEditHandler;
             }
         }
 
+        private void PdfViewerControl_MouseLeftButtonUp(object sender, MouseEventObject e)
+        {
+            if (e.IsCreate)
+            {
+                pdfViewerControl.UpdateAnnotFrame();
+            }
+        }
+
 
         //private void PdfViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
         //{
@@ -127,7 +138,7 @@ namespace Compdfkit_Tools.PDFControl
             if (this.pdfViewerControl != null)
             {
                 //this.pdfViewerControl.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
-                pdfViewerControl.PDFToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
+                pdfViewerControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
             }
         }
 
@@ -444,10 +455,10 @@ namespace Compdfkit_Tools.PDFControl
                             {
                                 frame.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
                             }
-                            pdfViewerControl.PDFViewTool.GetCPDFViewer().SetStampMouseImage(imageArray, frame.PixelWidth, frame.PixelHeight);
+                            pdfViewerControl.SetStampMouseImage(imageArray, frame.PixelWidth, frame.PixelHeight);
                         }
-                        pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsVisibleCustomMouse(true);
-                        pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(true);
+                        pdfViewerControl.SetIsVisibleCustomMouse(true);
+                        pdfViewerControl.SetIsShowStampMouse(true);
                     }
                     break;
                 case CPDFAnnotationType.Signature:
@@ -461,9 +472,11 @@ namespace Compdfkit_Tools.PDFControl
                             case C_ANNOTATION_TYPE.C_ANNOTATION_STAMP:
                                 {
                                     StampParam stampParam = (StampParam)signatureParam;
+                                    stampParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_STAMP;
                                     stampParam.ImageStream.Seek(0, SeekOrigin.Begin);
                                     decoder = BitmapDecoder.Create(stampParam.ImageStream, BitmapCreateOptions.None, BitmapCacheOption.Default);
                                     BitmapFrame frame = null;
+                                    pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
                                     if (decoder != null && decoder.Frames.Count > 0)
                                     {
                                         frame = decoder.Frames[0];
@@ -484,9 +497,9 @@ namespace Compdfkit_Tools.PDFControl
                                         {
                                             frame.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
                                         }
-                                        pdfViewerControl.PDFViewTool.GetCPDFViewer().SetStampMouseImage(imageArray, frame.PixelWidth, frame.PixelHeight);
-                                        pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsVisibleCustomMouse(true);
-                                        pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(true);
+                                        pdfViewerControl.SetStampMouseImage(imageArray, frame.PixelWidth, frame.PixelHeight);
+                                        pdfViewerControl.SetIsVisibleCustomMouse(true);
+                                        pdfViewerControl.SetIsShowStampMouse(true);
                                         annotHandlerEventArgs = signatureParam;
                                     }
                                 }
@@ -496,9 +509,9 @@ namespace Compdfkit_Tools.PDFControl
                                     WriteableBitmap writeableBitmap = CreateInkImaget(signatureParam as InkParam);
                                     byte[] imageArray = new byte[writeableBitmap.PixelWidth * writeableBitmap.PixelHeight * 4];
                                     writeableBitmap.CopyPixels(imageArray, writeableBitmap.PixelWidth * 4, 0);
-                                    pdfViewerControl.PDFViewTool.GetCPDFViewer().SetStampMouseImage(imageArray, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight);
-                                    pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsVisibleCustomMouse(true);
-                                    pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(true);
+                                    pdfViewerControl.SetStampMouseImage(imageArray, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight);
+                                    pdfViewerControl.SetIsVisibleCustomMouse(true);
+                                    pdfViewerControl.SetIsShowStampMouse(true);
                                     annotHandlerEventArgs = signatureParam;
                                 }
                                 break;
@@ -521,12 +534,11 @@ namespace Compdfkit_Tools.PDFControl
                     break;
             }
             pdfViewerControl.SetToolType(ToolType.CreateAnnot);
-            if (annotationType != CPDFAnnotationType.Stamp && annotationType != CPDFAnnotationType.Signature)
+            if (annotationType != CPDFAnnotationType.Stamp && annotationType != CPDFAnnotationType.Signature && annotationType != CPDFAnnotationType.Image)
             {
                 pdfViewerControl.SetIsShowStampMouse(false);
             }
             pdfViewerControl.SetAnnotParam(annotHandlerEventArgs);
-
         }
 
         private WriteableBitmap CreateInkImaget(InkParam inkParam)
@@ -750,8 +762,8 @@ namespace Compdfkit_Tools.PDFControl
         public void AnnotationCancel()
         {
             this.pdfViewerControl.SetToolType(ToolType.Pan);
-            pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(false);
-            ClearPanel();
+            pdfViewerControl.SetIsShowStampMouse(false);
+            //ClearPanel();
         }
 
         private void CPDFAnnotationControl_PropertyChanged(object sender, CPDFAnnotationData e)
@@ -914,13 +926,35 @@ namespace Compdfkit_Tools.PDFControl
                             stampParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_STAMP;
                             stampParam.StampType = C_STAMP_TYPE.IMAGE_STAMP;
 
-                            bool SetStamp = pdfViewerControl.PDFViewTool.GetCPDFViewer().SetStampMouseImage(openFileDialog.FileName);
-                            pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsVisibleCustomMouse(SetStamp);
-                            pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(SetStamp);
-                            DefaultSettingParam defaultSettingParam = pdfViewerControl.PDFViewTool.GetDefaultSettingParam();
-                            defaultSettingParam.SetAnnotParam(stampParam);
+                            BitmapFrame frame = null;
+                            if (encoder != null && encoder.Frames.Count > 0)
+                            {
+                                frame = encoder.Frames[0];
+                            }
+                            if (frame != null)
+                            {
+                                byte[] imageArray = new byte[frame.PixelWidth * frame.PixelHeight * 4];
+                                if (frame.Format != PixelFormats.Bgra32)
+                                {
+                                    FormatConvertedBitmap covert = new FormatConvertedBitmap(
+                                        frame,
+                                        PixelFormats.Bgra32,
+                                        frame.Palette,
+                                        0);
+                                    covert.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
+                                }
+                                else
+                                {
+                                    frame.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
+                                }
+                                pdfViewerControl.SetStampMouseImage(imageArray, frame.PixelWidth, frame.PixelHeight);
+                            }
+
                             pdfViewerControl.SetToolType(ToolType.CreateAnnot);
                             pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
+                            pdfViewerControl.SetIsVisibleCustomMouse(true);
+                            pdfViewerControl.SetIsShowStampMouse(true);
+                            pdfViewerControl.SetAnnotParam(stampParam);
                         }
                         catch
                         {
@@ -1200,7 +1234,7 @@ namespace Compdfkit_Tools.PDFControl
 
         private void ShowTempAnnotPanel()
         {
-            BaseAnnot baseAnnot = pdfViewerControl.PDFToolManager.GetCacheHitTestAnnot();
+            BaseAnnot baseAnnot = pdfViewerControl.GetCacheHitTestAnnot();
             if (baseAnnot != null)
             {
                 CreatTempAnnotationPanel(baseAnnot);
@@ -1233,12 +1267,12 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (pdfViewerControl.PDFToolManager != null)
             {
-                if (pdfViewerControl.PDFToolManager.GetCacheHitTestAnnot() == null && isTempPanel)
+                if (pdfViewerControl.GetCacheHitTestAnnot() == null && isTempPanel)
                 {
                     ShowCurrentAnnotPanel();
                     isTempPanel = false;
                 }
-                else if (pdfViewerControl.PDFToolManager.GetCacheHitTestAnnot() != null)
+                else if (pdfViewerControl.GetCacheHitTestAnnot() != null)
                 {
                     ShowTempAnnotPanel();
                     isTempPanel = true;

+ 9 - 36
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreeTextUI.xaml.cs

@@ -7,12 +7,13 @@ using ComPDFKitViewer;
 using System;
 using System.Windows;
 using System.Windows.Controls;
+using System.Windows.Forms;
 using System.Windows.Media;
 using static ComPDFKit.PDFAnnotation.CTextAttribute.CFontNameHelper;
 
 namespace Compdfkit_Tools.PDFControlUI
 {
-    public partial class CPDFFreeTextUI : UserControl
+    public partial class CPDFFreeTextUI : System.Windows.Controls.UserControl
     {
         public event EventHandler<CPDFAnnotationData> PropertyChanged;
         private CPDFFreeTextAnnotation textAnnot;
@@ -46,11 +47,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     textAnnot.UpdateAp();
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        if (pdfViewer != null)
-                        {
-                            pdfViewer.UpDateAnnotFrame();
-                        }
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -84,11 +81,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     textAnnot.UpdateAp();
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        if (pdfViewer != null)
-                        {
-                            pdfViewer.UpDateAnnotFrame();
-                        }
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -113,11 +106,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     textAnnot.UpdateAp();
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        if (pdfViewer != null)
-                        {
-                            pdfViewer.UpDateAnnotFrame();
-                        }
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -141,11 +130,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 textAnnot.UpdateAp();
                 if (viewControl != null && viewControl.PDFViewTool != null)
                 {
-                    CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                    if (pdfViewer != null)
-                    {
-                        pdfViewer.UpDateAnnotFrame();
-                    }
+                    viewControl.UpdateAnnotFrame() ;
                 }
             }
             CPDFAnnotationPreviewerControl.DrawFreeTextPreview(GetFreeTextData());
@@ -163,11 +148,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 textAnnot.UpdateAp();
                 if (viewControl != null && viewControl.PDFViewTool != null)
                 {
-                    CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                    if (pdfViewer != null)
-                    {
-                        pdfViewer.UpDateAnnotFrame();
-                    }
+                    viewControl.UpdateAnnotFrame();
                 }
             }
             CPDFAnnotationPreviewerControl.DrawFreeTextPreview(GetFreeTextData());
@@ -193,11 +174,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 textAnnot.UpdateAp();
                 if (viewControl != null && viewControl.PDFViewTool != null)
                 {
-                    CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                    if (pdfViewer != null)
-                    {
-                        pdfViewer.UpDateAnnotFrame();
-                    }
+                    viewControl.UpdateAnnotFrame() ;
                 }
             }
             CPDFAnnotationPreviewerControl.DrawFreeTextPreview(GetFreeTextData());
@@ -215,11 +192,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 textAnnot.UpdateAp();
                 if (viewControl != null && viewControl.PDFViewTool != null)
                 {
-                    CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                    if (pdfViewer != null)
-                    {
-                        pdfViewer.UpDateAnnotFrame();
-                    }
+                    viewControl.UpdateAnnotFrame();
                 }
             }
         }

+ 4 - 4
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreehandUI.xaml.cs

@@ -53,7 +53,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     transparent = transparent * 255;
                 }
                 cPDFAnnotation.SetTransparency((byte)transparent);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
             CPDFAnnotationPreviewerControl.DrawFreehandPreview(GetFreehandData());
 
@@ -68,7 +68,7 @@ namespace Compdfkit_Tools.PDFControlUI
             else
             {
                 cPDFAnnotation.SetThickness(CPDFThicknessControl.Thickness);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
             CPDFAnnotationPreviewerControl.DrawFreehandPreview(GetFreehandData());
 
@@ -88,7 +88,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 Color[1] = ((SolidColorBrush)ColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)ColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetInkColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
             CPDFAnnotationPreviewerControl.DrawFreehandPreview(GetFreehandData());
 
@@ -107,7 +107,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 Color[1] = ((SolidColorBrush)ColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)ColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetContent(NoteTextBox.Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 

+ 3 - 6
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFMarkupUI.xaml.cs

@@ -38,8 +38,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     markupAnnot.SetTransparency((byte)(CPDFOpacityControl.OpacityValue / 100.0 * 255));
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -65,8 +64,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     });
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -86,8 +84,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     markupAnnot.SetContent(NoteTextBox.Text);
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }

+ 2 - 4
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFNoteUI.xaml.cs

@@ -43,8 +43,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     });
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -64,8 +63,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     textAnnot.SetContent(NoteTextBox.Text);
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }

+ 7 - 14
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFShapeUI.xaml.cs

@@ -80,8 +80,7 @@ namespace Compdfkit_Tools.PDFControlUI
 
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 } 
             }
@@ -134,8 +133,7 @@ namespace Compdfkit_Tools.PDFControlUI
 
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -174,8 +172,7 @@ namespace Compdfkit_Tools.PDFControlUI
 
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -217,8 +214,7 @@ namespace Compdfkit_Tools.PDFControlUI
 
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }
@@ -275,8 +271,7 @@ namespace Compdfkit_Tools.PDFControlUI
 
                         if (viewControl != null && viewControl.PDFViewTool != null)
                         {
-                            CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                            pdfViewer?.UpDateAnnotFrame();
+                            viewControl.UpdateAnnotFrame();
                         }
                     }
                 }
@@ -302,8 +297,7 @@ namespace Compdfkit_Tools.PDFControlUI
                             lineAnnot.SetLineType(CPDFArrowControl.LineType.HeadLineType, CPDFArrowControl.LineType.TailLineType);
                             if (viewControl != null && viewControl.PDFViewTool != null)
                             {
-                                CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                                pdfViewer?.UpDateAnnotFrame();
+                                viewControl.UpdateAnnotFrame();
                             }
                         }
                     }
@@ -326,8 +320,7 @@ namespace Compdfkit_Tools.PDFControlUI
 
                     if (viewControl != null && viewControl.PDFViewTool != null)
                     {
-                        CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                        pdfViewer?.UpDateAnnotFrame();
+                        viewControl.UpdateAnnotFrame();
                     }
                 }
             }

+ 1 - 2
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFSignatureUI.xaml.cs

@@ -98,8 +98,7 @@ namespace Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI
                             signatureWidget.UpdateApWithImage(ImageArray, ImageWidth, ImageHeight, C_Scale_Type.fitCenter, 0);
                             if(viewControl!=null && viewControl.PDFViewTool!=null)
                             {
-                                CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                                pdfViewer.UpDateAnnotFrame();
+                                viewControl.UpdateAnnotFrame();
                             }
                         }
                     }

+ 1 - 5
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFTempStampUI.xaml.cs

@@ -42,11 +42,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 stampAnnot.UpdateAp();
                 if (viewControl != null && viewControl.PDFViewTool != null)
                 {
-                    CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
-                    if (pdfViewer != null)
-                    {
-                        pdfViewer.UpDateAnnotFrame();
-                    }
+                    viewControl.UpdateAnnotFrame();
                 }
             }
         }

+ 6 - 14
Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml.cs

@@ -166,6 +166,7 @@ namespace Compdfkit_Tools.PDFControl
                         default:
                             break;
                     }
+                    PdfViewControl.UpdateAnnotFrame();
                 }
             }
          }
@@ -174,7 +175,7 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (e.annotType== C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET)
             {
-                BaseWidget baseWidget = PdfViewControl.PDFToolManager.GetCacheHitTestWidget();
+                BaseWidget baseWidget = PdfViewControl.GetCacheHitTestWidget();
                 if (baseWidget!=null)
                 {
                     switch ((baseWidget.GetAnnotData().Annot as CPDFWidget).WidgeType)
@@ -282,11 +283,9 @@ namespace Compdfkit_Tools.PDFControl
         public void InitWithPDFViewer(PDFViewControl pDFViewControl)
         {
             PdfViewControl = pDFViewControl;
-            PdfViewControl.SplitPDFViewToolCreated -= PdfViewControl_SplitPDFViewToolCreated;
-            PdfViewControl.SplitPDFViewToolCreated += PdfViewControl_SplitPDFViewToolCreated;
-            PdfViewControl.PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
-            PdfViewControl.PDFToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
-            PdfViewControl.PDFToolManager.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
+            PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
+            PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
+            PdfViewControl.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
             PDFFormTool.InitWithPDFViewer(pDFViewControl, FromPropertyControl);
             FloatPageTool.InitWithPDFViewer(pDFViewControl);
             PDFGrid.Child = PdfViewControl;
@@ -325,14 +324,6 @@ namespace Compdfkit_Tools.PDFControl
             newPDFViewer.CustomSignHandle = true;
         }
 
-        private void PdfViewControl_SplitPDFViewToolCreated(object sender, EventArgs e)
-        {
-            PdfViewControl.PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
-            PdfViewControl.PDFToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
-            PdfViewControl.PDFToolManager.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
-            PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
-        }
-
         public void UnloadEvent()
         {
 
@@ -344,6 +335,7 @@ namespace Compdfkit_Tools.PDFControl
             BotaContainer.Child = null;
             PropertyContainer.Child = null;
             displaySettingsControl = null;
+            PdfViewControl.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_NONE);
         }
 
         #endregion

+ 7 - 7
Demo/Examples/Compdfkit_Tools/Form/Property/CheckBoxProperty.xaml.cs

@@ -56,7 +56,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFieldName((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -65,7 +65,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFlags( ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -78,7 +78,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBorderRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -91,7 +91,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBgRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -100,7 +100,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetWidgetCheckStyle((C_CHECK_STYLE)(sender as ComboBox).SelectedIndex);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -109,7 +109,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetChecked(true);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -118,7 +118,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetChecked(false);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
     }

+ 10 - 10
Demo/Examples/Compdfkit_Tools/Form/Property/ComboBoxProperty.xaml.cs

@@ -127,7 +127,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFieldName((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -136,7 +136,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFlags(ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -149,7 +149,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBorderRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -162,7 +162,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBgRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -178,7 +178,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontColor = Color;
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -193,7 +193,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -227,7 +227,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -239,7 +239,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontSize = Convert.ToSingle((sender as ComboBox).SelectedItem);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -297,7 +297,7 @@ namespace Compdfkit_Tools.PDFControl
             {
                 cPDFAnnotation.SelectItem(itemsListBox.SelectedIndex);
             }
-            pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+            pdfViewerControl.UpdateAnnotFrame();
             CheckListCount();
         }
         private void CheckListCount()
@@ -346,7 +346,7 @@ namespace Compdfkit_Tools.PDFControl
             if (itemsListBox.SelectedIndex >= 0)
             {
                 cPDFAnnotation.SelectItem(itemsListBox.SelectedIndex);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 

+ 10 - 10
Demo/Examples/Compdfkit_Tools/Form/Property/ListBoxProperty.xaml.cs

@@ -130,7 +130,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFieldName((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -139,7 +139,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFlags(ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -152,7 +152,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBorderRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -165,7 +165,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBgRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -181,7 +181,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontColor = Color;
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -196,7 +196,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -230,7 +230,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -242,7 +242,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontSize = Convert.ToSingle((sender as ComboBox).SelectedItem);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -301,7 +301,7 @@ namespace Compdfkit_Tools.PDFControl
             {
                 cPDFAnnotation.SelectItem(itemsListBox.SelectedIndex);
             }
-            pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+            pdfViewerControl.UpdateAnnotFrame();
 
             CheckListCount();
         }
@@ -351,7 +351,7 @@ namespace Compdfkit_Tools.PDFControl
             if (itemsListBox.SelectedIndex >= 0)
             {
                 cPDFAnnotation.SelectItem(itemsListBox.SelectedIndex);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 

+ 10 - 10
Demo/Examples/Compdfkit_Tools/Form/Property/PushButtonProperty.xaml.cs

@@ -139,7 +139,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFieldName((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -149,7 +149,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFlags(ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -163,7 +163,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBorderRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -177,7 +177,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBgRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -193,7 +193,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontColor = Color;
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -208,7 +208,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -243,7 +243,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -255,7 +255,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontSize = Convert.ToSingle((sender as ComboBox).SelectedItem);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
         #endregion
@@ -322,14 +322,14 @@ namespace Compdfkit_Tools.PDFControl
                 cPDFAnnotation.SetButtonAction(uriAction);
             }
 
-            pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+            pdfViewerControl.UpdateAnnotFrame();
         }
         private void ItemText_TextChanged(object sender, TextChangedEventArgs e)
         {
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetButtonTitle((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 

+ 7 - 7
Demo/Examples/Compdfkit_Tools/Form/Property/RadioButtonProperty.xaml.cs

@@ -82,7 +82,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFieldName((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -91,7 +91,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFlags(ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -104,7 +104,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBorderRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -117,7 +117,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBgRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -126,7 +126,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetWidgetCheckStyle((C_CHECK_STYLE)(sender as ComboBox).SelectedIndex);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -135,7 +135,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetChecked(true);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -144,7 +144,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetChecked(false);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
     }

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Form/Property/SignatureProperty.xaml.cs

@@ -46,7 +46,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFlags(ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
     }

+ 12 - 12
Demo/Examples/Compdfkit_Tools/Form/Property/TextFieldProperty.xaml.cs

@@ -116,7 +116,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFieldName((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -126,7 +126,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetFlags(ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -140,7 +140,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BorderColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBorderRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -154,7 +154,7 @@ namespace Compdfkit_Tools.PDFControl
                 Color[1] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.G;
                 Color[2] = ((SolidColorBrush)BackgroundColorPickerControl.Brush).Color.B;
                 cPDFAnnotation.SetWidgetBgRGBColor(Color);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -170,7 +170,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontColor = Color;
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -185,7 +185,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -219,7 +219,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontName = ObtainFontName(fontType, isBold, isItalic);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -231,7 +231,7 @@ namespace Compdfkit_Tools.PDFControl
                 cTextAttribute.FontSize = Convert.ToSingle((sender as ComboBox).SelectedItem);
                 cPDFAnnotation.SetTextAttribute(cTextAttribute);
                 cPDFAnnotation.UpdateFormAp();
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -240,7 +240,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetJustification((C_TEXT_ALIGNMENT)(sender as ComboBox).SelectedIndex);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -249,7 +249,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetText((sender as TextBox).Text);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -258,7 +258,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetMultiLine(true);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 
@@ -267,7 +267,7 @@ namespace Compdfkit_Tools.PDFControl
             if (IsLoadedData)
             {
                 cPDFAnnotation.SetMultiLine(false);
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
+                pdfViewerControl.UpdateAnnotFrame();
             }
         }
 

+ 2 - 2
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs

@@ -55,7 +55,7 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (ViewControl != null && ViewControl.PDFViewTool != null)
             {
-                CPDFViewer pdfViewer = ViewControl.SelectedPDFViewTool.GetCPDFViewer();
+                CPDFViewer pdfViewer = ViewControl.FocusPDFViewTool.GetCPDFViewer();
                 if (pdfViewer != null)
                 {
                     pdfViewer?.SetViewMode(e);
@@ -85,7 +85,7 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (ViewControl != null && ViewControl.PDFViewTool != null)
             {
-                CPDFViewer pdfViewer = ViewControl.SelectedPDFViewTool.GetCPDFViewer();
+                CPDFViewer pdfViewer = ViewControl.FocusPDFViewTool.GetCPDFViewer();
                 if (pdfViewer != null)
                 {
                     ViewModeUI.SetViewModeUI(pdfViewer.GetViewMode());

+ 100 - 72
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs

@@ -5,6 +5,8 @@ using ComPDFKit.Tool;
 using ComPDFKit.Tool.SettingParam;
 using Compdfkit_Tools.PDFControlUI;
 using ComPDFKitViewer;
+using ComPDFKitViewer.BaseObject;
+using ComPDFKitViewer.Widget;
 using Nager.Country.Currencies;
 using System;
 using System.Collections.Generic;
@@ -15,6 +17,7 @@ using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using static ComPDFKit.Tool.CPDFToolManager;
+using static Compdfkit_Tools.PDFControlUI.CPDFViewModeUI;
 using SplitMode = Compdfkit_Tools.PDFControlUI.CPDFViewModeUI.SplitMode;
 
 namespace Compdfkit_Tools.PDFControl
@@ -27,15 +30,16 @@ namespace Compdfkit_Tools.PDFControl
         private CPDFViewerTool viewerTool;
         private CPDFToolManager toolManager;
 
-        private AnnotParam annotParam;
-
         public CPDFViewerTool PDFViewTool { get;private set; }
         public CPDFToolManager PDFToolManager { get;private set; }
 
-        public CPDFViewerTool SelectedPDFViewTool { get;private set; }
+        public CPDFViewerTool FocusPDFViewTool { get;private set; }
 
-        public event EventHandler SplitPDFViewToolCreated;
+        //public event EventHandler SplitPDFViewToolCreated;
         public event EventHandler SelectedPDFViewToolChanged;
+        public event EventHandler<MouseEventObject> MouseLeftButtonDownHandler;
+        public event EventHandler<MouseEventObject> MouseLeftButtonUpHandler;
+        public event EventHandler<MouseEventObject> MouseMoveHandler;
 
         #region Properties
 
@@ -46,40 +50,55 @@ namespace Compdfkit_Tools.PDFControl
         public PDFViewControl()
         {
             InitializeComponent();
-            //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;
-            //}
             viewerTool = new CPDFViewerTool();
             toolManager = new CPDFToolManager(viewerTool);
             PDFViewTool = viewerTool;
             PDFToolManager = toolManager;
-            SelectedPDFViewTool = viewerTool;
+            PDFToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
+
+            splitViewerTool = new CPDFViewerTool();
+            splitToolManager = new CPDFToolManager(splitViewerTool);
+            splitToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
+            splitViewerTool.SizeChanged += SplitViewerTool_SizeChanged;
+
+            FocusPDFViewTool = viewerTool;
             PDFView.Child = PDFViewTool;
+
             PDFViewTool.SizeChanged += PDFViewTool_SizeChanged;
             PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler += PDFViewControl_MouseWheelZoomHandler;
-            PDFToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
+            PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
+            PDFToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
+            PDFToolManager.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
+
+            splitViewerTool.GetCPDFViewer().MouseWheelZoomHandler += SplitPDFViewControl_MouseWheelZoomHandler;
+            splitToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
+            splitToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
+            splitToolManager.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
+        }
+
+        private void PDFToolManager_MouseMoveHandler(object sender, MouseEventObject e)
+        {
+            MouseMoveHandler?.Invoke(this, e);
+        }
+
+        private void PDFToolManager_MouseLeftButtonUpHandler(object sender, MouseEventObject e)
+        {
+            MouseLeftButtonUpHandler?.Invoke(sender, e);
+        }
+
+        private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
+        {
+            MouseLeftButtonDownHandler?.Invoke(sender,e);
         }
 
         private void PDFViewTool_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-            PDFViewTool.GetCPDFViewer().UpDateRenderFrame();
+            PDFViewTool?.GetCPDFViewer()?.UpDateRenderFrame();
+        }
+
+        private void SplitViewerTool_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+            splitViewerTool?.GetCPDFViewer()?.UpDateRenderFrame();
         }
 
         public void InitDocument(string Path)
@@ -91,6 +110,11 @@ namespace Compdfkit_Tools.PDFControl
 
                 PDFViewTool.GetCPDFViewer().SetFitMode(FitModes.FitHeight);
                 PDFViewTool.GetCPDFViewer().SetViewMode(ViewModes.SingleContinuous);
+
+                splitViewerTool.GetCPDFViewer().InitDoc(pdfDoc);
+
+                splitViewerTool.GetCPDFViewer().SetFitMode(FitModes.FitHeight);
+                splitViewerTool.GetCPDFViewer().SetViewMode(ViewModes.SingleContinuous);
             }
         }
 
@@ -102,7 +126,7 @@ namespace Compdfkit_Tools.PDFControl
                 PDFViewTool.GetCPDFViewer().SetFitMode(FitModes.FitZoom);
                 double zoom = PDFViewTool.GetCPDFViewer().GetZoom();
                 PDFViewTool.GetCPDFViewer().SetZoom(CheckZoomLevel(zoom, Convert.ToBoolean(e.WheelBehavior)));
-                PDFViewTool.GetCPDFViewer().UpDateRenderFrame();
+                PDFViewTool?.GetCPDFViewer()?.UpDateRenderFrame();
             }
         }
 
@@ -114,7 +138,7 @@ namespace Compdfkit_Tools.PDFControl
                 splitViewerTool.GetCPDFViewer().SetFitMode(FitModes.FitZoom);
                 double zoom = splitViewerTool.GetCPDFViewer().GetZoom();
                 splitViewerTool.GetCPDFViewer().SetZoom(CheckZoomLevel(zoom, Convert.ToBoolean(e.WheelBehavior)));
-                splitViewerTool.GetCPDFViewer().UpDateRenderFrame();
+                splitViewerTool?.GetCPDFViewer()?.UpDateRenderFrame();
             }
         }
 
@@ -127,7 +151,6 @@ namespace Compdfkit_Tools.PDFControl
                     break;
                 case SplitMode.Vertical:
                     RemoveSplitViewerTool();
-                    CreateSplitViewerTool();
                     if(splitViewerTool != null)
                     {
                         VerticalSplitter.Visibility = Visibility.Visible;
@@ -140,7 +163,6 @@ namespace Compdfkit_Tools.PDFControl
                     break;
                 case SplitMode.Horizontal:
                     RemoveSplitViewerTool();
-                    CreateSplitViewerTool();
                     if(splitViewerTool != null)
                     {
                         HorizontalSplitter.Visibility = Visibility.Visible;
@@ -152,91 +174,99 @@ namespace Compdfkit_Tools.PDFControl
                     break;
             }
             UpdateFrame();
+            UpdateAnnotFrame();
         }
 
         public void UpdateFrame()
         {
-            viewerTool.GetCPDFViewer().UpDateRenderFrame();
+            viewerTool?.GetCPDFViewer()?.UpDateRenderFrame();
             splitViewerTool?.GetCPDFViewer()?.UpDateRenderFrame();
         }
 
+        public void UpdateAnnotFrame()
+        {
+            viewerTool?.GetCPDFViewer()?.UpDateAnnotFrame();
+            splitViewerTool?.GetCPDFViewer()?.UpDateAnnotFrame();
+        }
+
         public void SetToolType(ToolType type)
         {
-            toolManager.SetToolType(type);
+            toolManager?.SetToolType(type);
             splitToolManager?.SetToolType(type);
         }
 
         public void SetCreateAnnotType(C_ANNOTATION_TYPE type)
         {
-            toolManager.SetCreateAnnotType(type);
+            toolManager?.SetCreateAnnotType(type);
             splitToolManager?.SetCreateAnnotType(type);
         }
 
         public void SetCreateWidgetType(C_WIDGET_TYPE type)
         {
-            toolManager.SetCreateWidgetType(type);
+            toolManager?.SetCreateWidgetType(type);
             splitToolManager?.SetCreateWidgetType(type);
         }
 
         public void SetAnnotParam(AnnotParam param)
         {
-            annotParam = param;
             DefaultSettingParam defaultSettingParam = viewerTool.GetDefaultSettingParam();
-            DefaultSettingParam splitDefaultSettingParam = splitViewerTool?.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(annotParam);
-            splitDefaultSettingParam?.SetAnnotParam(annotParam);
+            DefaultSettingParam splitSettingParam = splitViewerTool.GetDefaultSettingParam();
+            defaultSettingParam.SetAnnotParam(param);
+            splitSettingParam.SetAnnotParam(param);
         }
 
         public void SetIsShowStampMouse(bool isShow)
         {
-            viewerTool.GetCPDFViewer().SetIsShowStampMouse(isShow);
+            viewerTool?.GetCPDFViewer()?.SetIsShowStampMouse(isShow);
             splitViewerTool?.GetCPDFViewer()?.SetIsShowStampMouse(isShow);
         }
 
         public void SetDrawModes(DrawModeData drawMode)
         {
-            viewerTool.GetCPDFViewer().SetDrawModes(drawMode.DrawMode);
+            viewerTool?.GetCPDFViewer()?.SetDrawModes(drawMode.DrawMode);
             splitViewerTool?.GetCPDFViewer()?.SetDrawModes(drawMode.DrawMode);
             UpdateFrame();
         }
 
-        private void CreateSplitViewerTool()
+        public void SetStampMouseImage(byte[] imageArray,int imageWidth,int imageHeight)
         {
-            if (viewerTool.GetCPDFViewer().GetDocument() != null)
+            viewerTool?.GetCPDFViewer()?.SetStampMouseImage(imageArray, imageWidth, imageHeight);
+            splitViewerTool?.GetCPDFViewer()?.SetStampMouseImage(imageArray, imageWidth, imageHeight);
+        }
+
+        public bool SetStampMouseImage(string filePath)
+        {
+            if((bool)(viewerTool?.GetCPDFViewer()?.SetStampMouseImage(filePath)) && (bool)splitViewerTool?.GetCPDFViewer()?.SetStampMouseImage(filePath))
             {
-                splitViewerTool = new CPDFViewerTool();
-                splitViewerTool.GetCPDFViewer().InitDoc(viewerTool.GetCPDFViewer().GetDocument());
-                splitToolManager = new CPDFToolManager(splitViewerTool);
-                splitViewerTool.SizeChanged += SplitViewerTool_SizeChanged;
-                splitViewerTool.GetCPDFViewer().MouseWheelZoomHandler += SplitPDFViewControl_MouseWheelZoomHandler;
-
-                ToolType toolType = toolManager.GetToolType();
-                splitToolManager.SetToolType(toolType);
-                if (toolType == ToolType.CreateAnnot)
-                {
-                    C_ANNOTATION_TYPE createAnnotType = toolManager.GetAnnotType();
-                    splitToolManager.SetCreateAnnotType(createAnnotType);
-                    DefaultSettingParam defaultSettingParam = splitViewerTool.GetDefaultSettingParam();
-                    defaultSettingParam.SetAnnotParam(annotParam);
-                }
-                if(toolType == ToolType.FormEdit)
-                {
-                    splitToolManager.SetCreateWidgetType((annotParam as FormParm).WidgetType);
-                    DefaultSettingParam defaultSettingParam = splitViewerTool.GetDefaultSettingParam();
-                    defaultSettingParam.SetAnnotParam(annotParam);
-                }
-                SplitPDFViewToolCreated?.Invoke(this, EventArgs.Empty);
+                return true;
             }
+            return false;
         }
 
-        private void SplitViewerTool_SizeChanged(object sender, SizeChangedEventArgs e)
+        public void SetIsVisibleCustomMouse(bool isVisbleCustomMouse)
+        {
+            viewerTool?.GetCPDFViewer()?.SetIsVisibleCustomMouse(isVisbleCustomMouse);
+            splitViewerTool?.GetCPDFViewer()?.SetIsVisibleCustomMouse(isVisbleCustomMouse);
+        }
+
+        public CPDFViewer GetCPDFViewer()
         {
-            splitViewerTool.GetCPDFViewer().UpDateRenderFrame();
+            return FocusPDFViewTool?.GetCPDFViewer();
+        }
+
+        public BaseWidget GetCacheHitTestWidget()
+        {
+            return FocusPDFViewTool?.GetCacheHitTestWidget();
+        }
+
+        public BaseAnnot GetCacheHitTestAnnot()
+        {
+            return FocusPDFViewTool?.GetCacheHitTestAnnot();
         }
 
         private void RemoveSplitViewerTool()
         {
-            PDFViewTool.GetCPDFViewer().UpDateRenderFrame();
+            UpdateFrame();
             VerticalSplitter.Visibility = Visibility.Collapsed;
             HorizontalSplitter.Visibility = Visibility.Collapsed;
             VerticalView.Visibility = Visibility.Collapsed;
@@ -245,8 +275,6 @@ namespace Compdfkit_Tools.PDFControl
             ViewToolGrid.ColumnDefinitions[2].Width = new GridLength(0);
             ViewToolGrid.RowDefinitions[1].Height = new GridLength(0);
             ViewToolGrid.RowDefinitions[2].Height = new GridLength(0);
-            splitViewerTool = null;
-            splitToolManager = null;
             VerticalView.Child = null;
             HorizontalView.Child = null;
         }
@@ -256,10 +284,10 @@ namespace Compdfkit_Tools.PDFControl
             switch((sender as Border).Tag)
             {
                 case "ViewerTool":
-                    SelectedPDFViewTool = viewerTool;
+                    FocusPDFViewTool = viewerTool;
                     break;
                 case "SplitViewerTool":
-                    SelectedPDFViewTool = splitViewerTool;
+                    FocusPDFViewTool = splitViewerTool;
                     break;
             }
             SelectedPDFViewToolChanged?.Invoke(this,EventArgs.Empty);

+ 0 - 8
Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml.cs

@@ -99,8 +99,6 @@ namespace Compdfkit_Tools.PDFView
 
         private void InitialControl()
         {
-            PdfViewControl.SplitPDFViewToolCreated -= PdfViewControl_SplitPDFViewToolCreated;
-            PdfViewControl.SplitPDFViewToolCreated += PdfViewControl_SplitPDFViewToolCreated;
             PdfViewControl.PDFToolManager?.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.Pan);
             //PdfViewControl.PDFView?.SetShowLink(true);
             PDFGrid.Child = PdfViewControl; 
@@ -109,12 +107,6 @@ namespace Compdfkit_Tools.PDFView
             //PdfViewControl.PDFView.SetFormFieldHighlight(true);
         }
 
-        private void PdfViewControl_SplitPDFViewToolCreated(object sender, EventArgs e)
-        {
-            PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
-            PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
-        }
-
         public void InitWithPDFViewer(PDFViewControl pdfViewer)
         {
             PdfViewControl = pdfViewer;

+ 0 - 7
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -130,13 +130,6 @@ namespace PDFViewer
         {
             viewControl = new PDFViewControl();
             viewControl.InitDocument(filePath);
-            viewControl.SplitPDFViewToolCreated -= ViewControl_PDFViewToolChanged;
-            viewControl.SplitPDFViewToolCreated += ViewControl_PDFViewToolChanged;
-        }
-
-        private void ViewControl_PDFViewToolChanged(object sender, EventArgs e)
-        {
-
         }
 
         /// <summary>