Browse Source

Splitt View - 实现多页签,屏幕分割,刷新和图章待完善

sunhaonan 11 months ago
parent
commit
7c2dd4d73e

+ 8 - 1
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs

@@ -23,7 +23,7 @@ namespace Compdfkit_Tools.PDFControl
     {
         #region Property
         private bool isFirstLoad = true;
-        public PDFViewControl PDFViewControl = new PDFViewControl();
+        public PDFViewControl PDFViewControl;
         public CPDFAnnotationControl PDFAnnotationControl = null;
         private CPDFDisplaySettingsControl displaySettingsControl = null;
 
@@ -106,9 +106,16 @@ 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

+ 30 - 31
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs

@@ -208,13 +208,13 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (pdfAnnotationData == null)
             {
-                pdfViewerControl.PDFToolManager.SetToolType(ToolType.Pan);
+                pdfViewerControl.SetToolType(ToolType.Pan);
                 return;
             }
 
             CPDFAnnotationType annotationType = pdfAnnotationData.AnnotationType;
             AnnotParam annotHandlerEventArgs = null;
-            pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
+            pdfViewerControl.SetToolType(ToolType.CreateAnnot);
             switch (annotationType)
             {
                 case CPDFAnnotationType.Highlight:
@@ -229,7 +229,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as HighlightParam).Content = highlightData.Note;
                         (annotHandlerEventArgs as HighlightParam).Author = highlightData.Author;
                         (annotHandlerEventArgs as HighlightParam).Locked = highlightData.IsLocked;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT);
                     }
                     break;
 
@@ -244,7 +244,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as UnderlineParam).Author = underlineData.Author;
                         (annotHandlerEventArgs as UnderlineParam).Content = underlineData.Note;
                         (annotHandlerEventArgs as UnderlineParam).Locked = underlineData.IsLocked;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE);
                     }
                     break;
 
@@ -259,7 +259,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as StrikeoutParam).Locked = strikeoutData.IsLocked;
                         (annotHandlerEventArgs as StrikeoutParam).Author = strikeoutData.Author;
                         (annotHandlerEventArgs as StrikeoutParam).Content = strikeoutData.Note;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STRIKEOUT);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STRIKEOUT);
                     }
                     break;
 
@@ -274,7 +274,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as SquigglyParam).Locked = squigglyData.IsLocked;
                         (annotHandlerEventArgs as SquigglyParam).Author = squigglyData.Author;
                         (annotHandlerEventArgs as SquigglyParam).Content = squigglyData.Note;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_SQUIGGLY);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_SQUIGGLY);
                     }
                     break;
 
@@ -299,7 +299,7 @@ namespace Compdfkit_Tools.PDFControl
 
                         (annotHandlerEventArgs as SquareParam).Author = squareData.Author;
                         (annotHandlerEventArgs as SquareParam).Content = squareData.Note;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE);
                     }
                     break;
 
@@ -323,8 +323,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as CircleParam).BorderStyle = BorderStyle;
                         (annotHandlerEventArgs as CircleParam).Author = cicleData.Author;
                         (annotHandlerEventArgs as CircleParam).Content = cicleData.Note;
-
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE);
                     }
                     break;
 
@@ -345,7 +344,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as LineParam).TailLineType = lineData.LineType.TailLineType;
                         (annotHandlerEventArgs as LineParam).Author = lineData.Author;
                         (annotHandlerEventArgs as LineParam).Content = lineData.Note;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_LINE);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_LINE);
                     }
                     break;
 
@@ -359,7 +358,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as StickyNoteParam).Content = noteData.Note;
                         (annotHandlerEventArgs as StickyNoteParam).Transparency = 255;
                         (annotHandlerEventArgs as StickyNoteParam).Author = noteData.Author;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_TEXT);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_TEXT);
                     }
                     break;
 
@@ -374,7 +373,7 @@ namespace Compdfkit_Tools.PDFControl
                         (annotHandlerEventArgs as InkParam).Transparency = Convert.ToByte(freehandData.Opacity * 255);
                         (annotHandlerEventArgs as InkParam).Content = freehandData.Note;
                         (annotHandlerEventArgs as InkParam).Author = freehandData.Author;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_INK);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_INK);
                     }
                     break;
 
@@ -407,7 +406,7 @@ namespace Compdfkit_Tools.PDFControl
                         }
                         (annotHandlerEventArgs as FreeTextParam).Content = freeTextData.Note;
                         (annotHandlerEventArgs as FreeTextParam).Author = freeTextData.Author;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT);
                     }
                     break;
 
@@ -418,7 +417,7 @@ namespace Compdfkit_Tools.PDFControl
                         CPDFStampData stampData = pdfAnnotationData as CPDFStampData;
                         SetStamp(ref stampParam, stampData);
                         annotHandlerEventArgs = stampParam;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
 
                         stampParam.ImageStream.Seek(0, SeekOrigin.Begin);
                         BitmapDecoder decoder = BitmapDecoder.Create(stampParam.ImageStream,
@@ -512,22 +511,21 @@ namespace Compdfkit_Tools.PDFControl
                     if (annotHandlerEventArgs != null)
                     {
                         annotHandlerEventArgs.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_LINK;
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_LINK);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_LINK);
                     }
                     break;
                 case CPDFAnnotationType.Unknow:
-                    pdfViewerControl.PDFToolManager.SetToolType(ToolType.Pan);
+                    pdfViewerControl.SetToolType(ToolType.Pan);
                     return;
                 default:
                     break;
             }
-            pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
+            pdfViewerControl.SetToolType(ToolType.CreateAnnot);
             if (annotationType != CPDFAnnotationType.Stamp && annotationType != CPDFAnnotationType.Signature)
             {
-                pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(false);
+                pdfViewerControl.SetIsShowStampMouse(false);
             }
-            DefaultSettingParam defaultSettingParam = pdfViewerControl.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(annotHandlerEventArgs);
+            pdfViewerControl.SetAnnotParam(annotHandlerEventArgs);
 
         }
 
@@ -652,7 +650,7 @@ namespace Compdfkit_Tools.PDFControl
                             (annotParam as StampParam).ImageStream = memoryStream;
                         }
 
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
                     }
                     break;
                 case SignatureType.Drawing:
@@ -689,7 +687,7 @@ namespace Compdfkit_Tools.PDFControl
                         byte[] InkColor = new byte[] { stamp.inkColor.R, stamp.inkColor.G, stamp.inkColor.B };
                         (annotParam as InkParam).InkColor = InkColor;
 
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_INK);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_INK);
                     }
                     break;
                 default:
@@ -751,7 +749,7 @@ namespace Compdfkit_Tools.PDFControl
 
         public void AnnotationCancel()
         {
-            this.pdfViewerControl.PDFToolManager.SetToolType(ToolType.Pan);
+            this.pdfViewerControl.SetToolType(ToolType.Pan);
             pdfViewerControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(false);
             ClearPanel();
         }
@@ -874,8 +872,8 @@ namespace Compdfkit_Tools.PDFControl
                     LinkParam linkAnnotArgs = new LinkParam();
                     if (this.pdfViewerControl != null && pdfViewerControl.PDFViewTool != null && pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument() != null)
                     {
-                        pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
-                        pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_LINK);
+                        pdfViewerControl.SetToolType(ToolType.CreateAnnot);
+                        pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_LINK);
                         pdfLinkUI.InitLinkAnnotArgs(linkAnnotArgs, pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument().PageCount);
                     }
                     annotationPanel = pdfLinkUI;
@@ -942,8 +940,8 @@ namespace Compdfkit_Tools.PDFControl
                             }
                             DefaultSettingParam defaultSettingParam = pdfViewerControl.PDFViewTool.GetDefaultSettingParam();
                             defaultSettingParam.SetAnnotParam(stampParam);
-                            pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
-                            pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
+                            pdfViewerControl.SetToolType(ToolType.CreateAnnot);
+                            pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
                         }
                         catch
                         {
@@ -951,7 +949,7 @@ namespace Compdfkit_Tools.PDFControl
                     }
                     else
                     {
-                        pdfViewerControl.PDFToolManager.SetToolType(ToolType.Pan);
+                        pdfViewerControl.SetToolType(ToolType.Pan);
                         ClearAnnotationBar?.Invoke(this, EventArgs.Empty);
                     }
                     ClearPanel();
@@ -974,12 +972,13 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (e)
             {
+                //pdfViewerControl.PDFToolManager.ClearSelect();
                 pdfViewerControl.PDFViewTool.SetViewerModel(MouseModes.kCustomizeTool);
             }
             else
             {
-                pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
-                pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_INK);
+                pdfViewerControl.SetToolType(ToolType.CreateAnnot);
+                pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_INK);
             }
             //if (pdfViewerControl != null)
             //{
@@ -1189,7 +1188,7 @@ namespace Compdfkit_Tools.PDFControl
 
         public void LoadAnnotationPanel(CPDFAnnotationType annotationType)
         {
-            this.pdfViewerControl.PDFToolManager.SetToolType(ToolType.Pan);
+            this.pdfViewerControl.SetToolType(ToolType.Pan);
             currentAnnotationType = annotationType;
             annotationPanel = GetAnnotationPanel();
             InitAnnotationPanel(annotationType);

+ 24 - 31
Demo/Examples/Compdfkit_Tools/Common/BarControl/FormBarControl.xaml.cs

@@ -171,7 +171,7 @@ namespace Compdfkit_Tools.PDFControl
         private void FormBtn_Click(object sender, RoutedEventArgs e)
         {
             ClearToolState(sender as ToggleButton);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_NONE);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_NONE);
             fromPropertyControl.SetPropertyForType(null, null,null);
             if ((bool)(sender as ToggleButton).IsChecked)
             {
@@ -202,11 +202,11 @@ namespace Compdfkit_Tools.PDFControl
                     default:
                         break;
                 }
-                pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+                pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
             }
             else
             {
-                pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+                pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
             }
         }
 
@@ -245,8 +245,8 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CreateTextBox()
         {
-            pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_TEXTFIELD);
+            pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_TEXTFIELD);
             TextBoxParam textBoxParam = new TextBoxParam();
             textBoxParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET;
             textBoxParam.WidgetType = C_WIDGET_TYPE.WIDGET_TEXTFIELD;
@@ -257,14 +257,13 @@ namespace Compdfkit_Tools.PDFControl
             textBoxParam.Transparency = 255;
             textBoxParam.HasLineColor = true;
             textBoxParam.FieldName = "Text"+ GetTime();
-            DefaultSettingParam defaultSettingParam = pdfViewer.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(textBoxParam);
+            pdfViewer.SetAnnotParam(textBoxParam);
         }
 
         private void CreateRadioBtn()
         {
-            pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_RADIOBUTTON);
+            pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_RADIOBUTTON);
             RadioButtonParam radioButtonParam = new RadioButtonParam();
             radioButtonParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET;
             radioButtonParam.WidgetType = C_WIDGET_TYPE.WIDGET_RADIOBUTTON;
@@ -276,14 +275,13 @@ namespace Compdfkit_Tools.PDFControl
             radioButtonParam.HasLineColor = true;
             radioButtonParam.LineWidth = 2;
             radioButtonParam.FieldName = "Radio button" + GetTime();
-            DefaultSettingParam defaultSettingParam = pdfViewer.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(radioButtonParam);
+            pdfViewer.SetAnnotParam(radioButtonParam);
         }
 
         private void CreateCheckBox()
         {
-            pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_CHECKBOX);
+            pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_CHECKBOX);
             CheckBoxParam checkBoxParam = new CheckBoxParam();
             checkBoxParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET;
             checkBoxParam.WidgetType = C_WIDGET_TYPE.WIDGET_CHECKBOX;
@@ -295,14 +293,13 @@ namespace Compdfkit_Tools.PDFControl
             checkBoxParam.HasLineColor = true;
             checkBoxParam.LineWidth = 1;
             checkBoxParam.FieldName = "Checkbox" + GetTime();
-            DefaultSettingParam defaultSettingParam = pdfViewer.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(checkBoxParam);
+            pdfViewer.SetAnnotParam(checkBoxParam);
         }
 
         private void CreateComboBox()
         {
-            pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_COMBOBOX);
+            pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_COMBOBOX);
             ComboBoxParam comboBoxParam = new ComboBoxParam();
             comboBoxParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET;
             comboBoxParam.WidgetType = C_WIDGET_TYPE.WIDGET_COMBOBOX;
@@ -312,14 +309,13 @@ namespace Compdfkit_Tools.PDFControl
             comboBoxParam.HasLineColor = true;
             comboBoxParam.LineWidth = 1;
             comboBoxParam.FieldName = "Combobox" + GetTime();
-            DefaultSettingParam defaultSettingParam = pdfViewer.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(comboBoxParam);
+            pdfViewer.SetAnnotParam(comboBoxParam);
         }
 
         private void CreateListBox()
         {
-            pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_LISTBOX);
+            pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_LISTBOX);
             ListBoxParam listBoxParam = new ListBoxParam();
             listBoxParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET;
             listBoxParam.WidgetType = C_WIDGET_TYPE.WIDGET_LISTBOX;
@@ -329,14 +325,13 @@ namespace Compdfkit_Tools.PDFControl
             listBoxParam.HasLineColor = true;
             listBoxParam.LineWidth = 1;
             listBoxParam.FieldName = "List" + GetTime();
-            DefaultSettingParam defaultSettingParam = pdfViewer.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(listBoxParam);
+            pdfViewer.SetAnnotParam(listBoxParam);
         }
 
         private void CreatePushBtn()
         {
-            pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_PUSHBUTTON);
+            pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_PUSHBUTTON);
             PushButtonParam pushButtonParam = new PushButtonParam();
             pushButtonParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET;
             pushButtonParam.WidgetType = C_WIDGET_TYPE.WIDGET_PUSHBUTTON;
@@ -349,14 +344,13 @@ namespace Compdfkit_Tools.PDFControl
             pushButtonParam.FontColor = new byte[] { 0, 0, 0 };
             pushButtonParam.Transparency = 255;
             pushButtonParam.FieldName = "Button" + GetTime();
-            DefaultSettingParam defaultSettingParam = pdfViewer.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(pushButtonParam);
+            pdfViewer.SetAnnotParam(pushButtonParam);
         }
 
         private void CreateSign()
         {
-            pdfViewer.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-            pdfViewer.PDFToolManager.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS);
+            pdfViewer.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
+            pdfViewer.SetCreateWidgetType(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS);
             SignatureParam signatureParam = new SignatureParam();
             signatureParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET;
             signatureParam.WidgetType = C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS;
@@ -366,8 +360,7 @@ namespace Compdfkit_Tools.PDFControl
             signatureParam.FontColor = new byte[] { 0, 0, 0 };
             signatureParam.Transparency = 255;
             signatureParam.FieldName= "Signature" + GetTime();
-            DefaultSettingParam defaultSettingParam = pdfViewer.PDFViewTool.GetDefaultSettingParam();
-            defaultSettingParam.SetAnnotParam(signatureParam);
+            pdfViewer.SetAnnotParam(signatureParam);
         }
 
         #endregion

+ 9 - 1
Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs

@@ -23,7 +23,7 @@ namespace Compdfkit_Tools.PDFControl
     public partial class ContentEditControl : UserControl, INotifyPropertyChanged
     {
         #region Property
-        public PDFViewControl PdfViewControl = new PDFViewControl();
+        public PDFViewControl PdfViewControl;
         public PDFContentEditControl pdfContentEditControl = new PDFContentEditControl();
         private CPDFDisplaySettingsControl displaySettingsControl = null;
 
@@ -307,12 +307,20 @@ namespace Compdfkit_Tools.PDFControl
             PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
             PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
             PdfViewControl = view;
+            PdfViewControl.SplitPDFViewToolCreated -= PdfViewControl_SplitPDFViewToolCreated;
+            PdfViewControl.SplitPDFViewToolCreated += PdfViewControl_SplitPDFViewToolCreated;
             PDFGrid.Child = PdfViewControl;
             FloatPageTool.InitWithPDFViewer(view);
             pdfContentEditControl.InitWithPDFViewer(view);
             DataContext = this;
         }
 
+        private void PdfViewControl_SplitPDFViewToolCreated(object sender, EventArgs e)
+        {
+            PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+        }
+
 
         /// <summary>
         /// Text and Image Selected Event

+ 11 - 1
Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml.cs

@@ -20,7 +20,7 @@ namespace Compdfkit_Tools.PDFControl
     {
         #region Property
 
-        public PDFViewControl PdfViewControl = new PDFViewControl();
+        public PDFViewControl PdfViewControl;
         public FromPropertyControl FromPropertyControl = new FromPropertyControl();
         private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
         public event PropertyChangedEventHandler PropertyChanged;
@@ -282,6 +282,8 @@ 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;
@@ -323,6 +325,14 @@ 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()
         {
 

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

@@ -1,5 +1,6 @@
 using Compdfkit_Tools.PDFControlUI;
 using ComPDFKitViewer;
+using System;
 using System.Collections.Generic;
 using System.Windows;
 using System.Windows.Controls;
@@ -12,7 +13,7 @@ namespace Compdfkit_Tools.PDFControl
         /// PDFViewer
         /// </summary>
         private PDFViewControl ViewControl;
-
+        public event EventHandler<CPDFViewModeUI.SplitMode> SplitModeChanged;
         public CPDFDisplaySettingsControl()
         {
             InitializeComponent();
@@ -22,11 +23,16 @@ namespace Compdfkit_Tools.PDFControl
         private void CPDFDisplaySettingsControl_Loaded(object sender, RoutedEventArgs e)
         {
             ViewModeUI.ViewModeChanged += ViewModeUI_ViewModeChanged;
-            //ViewModeUI.SplitModeChanged += ViewModeUI_SplitModeChanged;
+            ViewModeUI.SplitModeChanged += ViewModeUI_SplitModeChanged;
             ViewModeUI.CropModeChanged += ViewModeUI_CropModeChanged;
             DrawModeUI.DrawModeChanged += DrawModeUI_DrawModeChanged;
         }
 
+        private void ViewModeUI_SplitModeChanged(object sender, CPDFViewModeUI.SplitMode e)
+        {
+            SplitModeChanged.Invoke(this, e);
+        }
+
         private void ViewModeUI_CropModeChanged(object sender, bool e)
         {
             //ViewControl?.SetCropMode(e);
@@ -36,21 +42,7 @@ namespace Compdfkit_Tools.PDFControl
         {
             if(ViewControl!=null && ViewControl.PDFViewTool!=null)
             {
-                CPDFViewer pdfViewer=ViewControl.PDFViewTool.GetCPDFViewer();
-                if(pdfViewer!=null)
-                {
-                    if (e.DrawMode != DrawModes.Custom)
-                    {
-                        pdfViewer?.SetDrawModes(e.DrawMode);
-                        pdfViewer?.UpDateRenderFrame();
-                    }
-                    else
-                    {
-                        pdfViewer?.SetDrawModes(e.DrawMode);
-                        pdfViewer?.SetPDFBackground(e.CustomColor);
-                        pdfViewer?.UpDateRenderFrame();
-                    }
-                }
+                ViewControl.SetDrawModes(e);
             }
         }
 
@@ -63,18 +55,20 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (ViewControl != null && ViewControl.PDFViewTool != null)
             {
-                CPDFViewer pdfViewer = ViewControl.PDFViewTool.GetCPDFViewer();
+                CPDFViewer pdfViewer = ViewControl.SelectedPDFViewTool.GetCPDFViewer();
                 if (pdfViewer != null)
                 {
                     pdfViewer?.SetViewMode(e);
                     pdfViewer?.UpDateRenderFrame();
                 }
-            }   
+            }
         }
 
         public void InitWithPDFViewer(PDFViewControl viewControl)
         {
             ViewControl = viewControl;
+            ViewControl.SelectedPDFViewToolChanged -= PDFViewControl_SelectedPDFViewToolChanged;
+            ViewControl.SelectedPDFViewToolChanged += PDFViewControl_SelectedPDFViewToolChanged;
             if(ViewControl != null && ViewControl.PDFViewTool!=null)
             {
                CPDFViewer pdfViewer=  viewControl.PDFViewTool.GetCPDFViewer();
@@ -87,6 +81,20 @@ namespace Compdfkit_Tools.PDFControl
             }
         }
 
+        private void PDFViewControl_SelectedPDFViewToolChanged(object sender,EventArgs e)
+        {
+            if (ViewControl != null && ViewControl.PDFViewTool != null)
+            {
+                CPDFViewer pdfViewer = ViewControl.SelectedPDFViewTool.GetCPDFViewer();
+                if (pdfViewer != null)
+                {
+                    ViewModeUI.SetViewModeUI(pdfViewer.GetViewMode());
+                    // ViewModeUI.SetSplitModeUI(ViewControl.Mode);
+                    //ViewModeUI.SetCropUI(ViewControl.IsCropMode());
+                }
+            }
+        }
+
         public void SetVisibilityWhenContentEdit(Visibility visible)
         {
             ViewModeUI?.SetSplitContainerVisibility(visible);

+ 10 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFViewModeControl.xaml.cs

@@ -3,6 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Windows;
 using System.Windows.Controls;
+using static Compdfkit_Tools.PDFControlUI.CPDFViewModeUI;
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -10,6 +11,8 @@ namespace Compdfkit_Tools.PDFControl
     {
         public PDFViewControl ViewControl;
 
+        public event EventHandler<SplitMode> SplitModeChanged;
+
         public string CurrentContinuousMode = "Continuous";
         public string CurrentViewMode = "Single";
 
@@ -37,6 +40,12 @@ namespace Compdfkit_Tools.PDFControl
             GetViewMode.Add(Tuple.Create("Discontinuous", "Book"), ViewModes.Book);
             CPDFViewModeUI.SetContinuousEvent += CPDFViewModeUI_SetContinuousEvent;
             CPDFViewModeUI.SetViewModeEvent += CPDFViewModeUI_SetViewModeEvent;
+            CPDFViewModeUI.SplitModeChanged += CPDFViewModeUI_SplitModeChanged; 
+        }
+
+        private void CPDFViewModeUI_SplitModeChanged(object sender, SplitMode e)
+        {
+            SplitModeChanged.Invoke(this, e);
         }
 
         private void CPDFViewModeUI_SetContinuousEvent(object sender, string e)
@@ -57,6 +66,6 @@ namespace Compdfkit_Tools.PDFControl
                 CPDFViewer pdfViewer = ViewControl.PDFViewTool.GetCPDFViewer();
                 pdfViewer?.SetViewMode(GetViewMode[Tuple.Create(CurrentContinuousMode, CurrentViewMode)]);
             }
-        } 
+        }
     }
 }

+ 36 - 29
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsUI/CPDFViewModeUI.xaml.cs

@@ -14,7 +14,7 @@ namespace Compdfkit_Tools.PDFControlUI
         public event EventHandler<string> SetContinuousEvent;
         public event EventHandler<string> SetViewModeEvent;
 
-        //public event EventHandler<SplitMode> SplitModeChanged;
+        public event EventHandler<SplitMode> SplitModeChanged;
 
         public event EventHandler<ViewModes> ViewModeChanged;
 
@@ -46,7 +46,7 @@ namespace Compdfkit_Tools.PDFControlUI
             VerticalBtn.IsChecked = false;
             HorizonPath.Fill = HorizonBtn.IsChecked == true ? ActivePathBrush : NormalPathBrush;
             VerticalPath.Fill = NormalPathBrush;
-            //SplitModeChanged?.Invoke(this, HorizonBtn.IsChecked == true ? SplitMode.Horizontal:SplitMode.None);
+            SplitModeChanged?.Invoke(this, HorizonBtn.IsChecked == true ? SplitMode.Horizontal : SplitMode.None);
         }
 
         private void VerticalBtn_Click(object sender, RoutedEventArgs e)
@@ -54,7 +54,7 @@ namespace Compdfkit_Tools.PDFControlUI
             HorizonBtn.IsChecked = false;
             HorizonPath.Fill = NormalPathBrush;
             VerticalPath.Fill = VerticalBtn.IsChecked == true ? ActivePathBrush : NormalPathBrush;
-            //SplitModeChanged?.Invoke(this, VerticalBtn.IsChecked == true ? SplitMode.Vertical : SplitMode.None);
+            SplitModeChanged?.Invoke(this, VerticalBtn.IsChecked == true ? SplitMode.Vertical : SplitMode.None);
         }
 
         private void ClearViewState()
@@ -133,32 +133,39 @@ namespace Compdfkit_Tools.PDFControlUI
             }
         }
 
-        //public void SetSplitModeUI(SplitMode mode)
-        //{
-        //    switch(mode)
-        //    {
-        //        case SplitMode.None:
-        //            HorizonBtn.IsChecked = false;
-        //            VerticalBtn.IsChecked = false;
-        //            HorizonPath.Fill = NormalPathBrush;
-        //            VerticalPath.Fill = NormalPathBrush;
-        //            break;
-        //        case SplitMode.Vertical:
-        //            VerticalBtn.IsChecked = true;
-        //            HorizonBtn.IsChecked = false;
-        //            HorizonPath.Fill = NormalPathBrush;
-        //            VerticalPath.Fill = ActivePathBrush;
-        //            break;
-        //        case SplitMode.Horizontal:
-        //            VerticalBtn.IsChecked = false;
-        //            HorizonBtn.IsChecked = true;
-        //            HorizonPath.Fill = ActivePathBrush;
-        //            VerticalPath.Fill = NormalPathBrush;
-        //            break;
-        //        default:
-        //            break;
-        //    }
-        //}
+        public enum SplitMode
+        {
+            None = 0,
+            Vertical,
+            Horizontal
+        }
+
+        public void SetSplitModeUI(SplitMode mode)
+        {
+            switch (mode)
+            {
+                case SplitMode.None:
+                    HorizonBtn.IsChecked = false;
+                    VerticalBtn.IsChecked = false;
+                    HorizonPath.Fill = NormalPathBrush;
+                    VerticalPath.Fill = NormalPathBrush;
+                    break;
+                case SplitMode.Vertical:
+                    VerticalBtn.IsChecked = true;
+                    HorizonBtn.IsChecked = false;
+                    HorizonPath.Fill = NormalPathBrush;
+                    VerticalPath.Fill = ActivePathBrush;
+                    break;
+                case SplitMode.Horizontal:
+                    VerticalBtn.IsChecked = false;
+                    HorizonBtn.IsChecked = true;
+                    HorizonPath.Fill = ActivePathBrush;
+                    VerticalPath.Fill = NormalPathBrush;
+                    break;
+                default:
+                    break;
+            }
+        }
 
         public void SetViewModeUI(ViewModes mode)
         {

+ 17 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml

@@ -5,4 +5,21 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
+    <Grid x:Name="ViewToolGrid">
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Tag="ViewerTool" Width="*"/>
+            <ColumnDefinition Width="0"/>
+            <ColumnDefinition Tag="SplitViewerTool" Width="0"/>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition Tag="ViewerTool" Height="*"/>
+            <RowDefinition Height="0"/>
+            <RowDefinition Tag="SplitViewerTool" Height="0"/>
+        </Grid.RowDefinitions>
+        <Border Tag="ViewerTool" GotFocus="PDFView_GotFocus" MinWidth="20" MinHeight="20" x:Name="PDFView" Grid.Row="0" Grid.Column="0"/>
+        <GridSplitter x:Name="VerticalSplitter" ResizeDirection="Columns" HorizontalAlignment="Stretch" Grid.Column="1" Width="15" Background="LightGray" Visibility="Collapsed"/>
+        <GridSplitter x:Name="HorizontalSplitter" ResizeDirection="Rows" VerticalAlignment="Stretch" Grid.Row="1" Width="{Binding ElementName=ViewToolGrid,Path=ActualWidth}" Height="15" Background="LightGray" Visibility="Collapsed"/>
+        <Border Tag="SplitViewerTool" GotFocus="PDFView_GotFocus" MinWidth="20" x:Name="VerticalView" Grid.Row="0" Grid.Column="2" Visibility="Collapsed"/>
+        <Border Tag="SplitViewerTool" GotFocus="PDFView_GotFocus" MinHeight="20" x:Name="HorizontalView" Grid.Column="0" Grid.Row="2" Visibility="Collapsed"/>
+    </Grid>
 </UserControl>

+ 213 - 29
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs

@@ -1,24 +1,43 @@
-using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFAnnotation.Form;
+using ComPDFKit.PDFDocument;
 using ComPDFKit.Tool;
+using ComPDFKit.Tool.SettingParam;
+using Compdfkit_Tools.PDFControlUI;
 using ComPDFKitViewer;
 using Nager.Country.Currencies;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Reflection;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
+using static ComPDFKit.Tool.CPDFToolManager;
+using SplitMode = Compdfkit_Tools.PDFControlUI.CPDFViewModeUI.SplitMode;
 
 namespace Compdfkit_Tools.PDFControl
 {
     public partial class PDFViewControl : UserControl
     {
-        static CPDFViewerTool ViewerTool = null;
-        static CPDFToolManager pDFToolManager = null;
-        public CPDFToolManager PDFToolManager = null;
+        private CPDFViewerTool splitViewerTool;
+        private CPDFToolManager splitToolManager;
+
+        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 event EventHandler SplitPDFViewToolCreated;
+        public event EventHandler SelectedPDFViewToolChanged;
+
         #region Properties
-        public CPDFViewerTool PDFViewTool { get; set; }
 
         public bool CustomSignHandle { get; set; }
 
@@ -27,28 +46,35 @@ 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;
-            }
-            Content = PDFViewTool;
-            //PDFToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
+            //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;
+            PDFView.Child = PDFViewTool;
+            PDFViewTool.SizeChanged += PDFViewTool_SizeChanged;
+            PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler += PDFViewControl_MouseWheelZoomHandler;
+            PDFToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
         }
 
         private void PDFViewTool_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -80,6 +106,165 @@ namespace Compdfkit_Tools.PDFControl
             }
         }
 
+        private void SplitPDFViewControl_MouseWheelZoomHandler(object sender, ComPDFKitViewer.MouseWheelZoomArgs e)
+        {
+            if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
+            {
+                e.IsZoom = true;
+                splitViewerTool.GetCPDFViewer().SetFitMode(FitModes.FitZoom);
+                double zoom = splitViewerTool.GetCPDFViewer().GetZoom();
+                splitViewerTool.GetCPDFViewer().SetZoom(CheckZoomLevel(zoom, Convert.ToBoolean(e.WheelBehavior)));
+                splitViewerTool.GetCPDFViewer().UpDateRenderFrame();
+            }
+        }
+
+        public void SetSplitViewMode(SplitMode splitMode)
+        {
+            switch (splitMode)
+            {
+                case SplitMode.None:
+                    RemoveSplitViewerTool();
+                    break;
+                case SplitMode.Vertical:
+                    RemoveSplitViewerTool();
+                    CreateSplitViewerTool();
+                    if(splitViewerTool != null)
+                    {
+                        VerticalSplitter.Visibility = Visibility.Visible;
+                        VerticalView.Visibility = Visibility.Visible;
+                        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:
+                    RemoveSplitViewerTool();
+                    CreateSplitViewerTool();
+                    if(splitViewerTool != null)
+                    {
+                        HorizontalSplitter.Visibility = Visibility.Visible;
+                        HorizontalView.Visibility = Visibility.Visible;
+                        ViewToolGrid.RowDefinitions[1].Height = new GridLength(15,GridUnitType.Auto);
+                        ViewToolGrid.RowDefinitions[2].Height = new GridLength(ViewToolGrid.ActualHeight / 2);
+                        HorizontalView.Child = splitViewerTool;
+                    }
+                    break;
+            }
+            UpdateFrame();
+        }
+
+        public void UpdateFrame()
+        {
+            viewerTool.GetCPDFViewer().UpDateRenderFrame();
+            splitViewerTool?.GetCPDFViewer()?.UpDateRenderFrame();
+        }
+
+        public void SetToolType(ToolType type)
+        {
+            toolManager.SetToolType(type);
+            splitToolManager?.SetToolType(type);
+        }
+
+        public void SetCreateAnnotType(C_ANNOTATION_TYPE type)
+        {
+            toolManager.SetCreateAnnotType(type);
+            splitToolManager?.SetCreateAnnotType(type);
+        }
+
+        public void SetCreateWidgetType(C_WIDGET_TYPE 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);
+        }
+
+        public void SetIsShowStampMouse(bool isShow)
+        {
+            viewerTool.GetCPDFViewer().SetIsShowStampMouse(isShow);
+            splitViewerTool?.GetCPDFViewer()?.SetIsShowStampMouse(isShow);
+        }
+
+        public void SetDrawModes(DrawModeData drawMode)
+        {
+            viewerTool.GetCPDFViewer().SetDrawModes(drawMode.DrawMode);
+            splitViewerTool?.GetCPDFViewer()?.SetDrawModes(drawMode.DrawMode);
+            UpdateFrame();
+        }
+
+        private void CreateSplitViewerTool()
+        {
+            if (viewerTool.GetCPDFViewer().GetDocument() != null)
+            {
+                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);
+            }
+        }
+
+        private void SplitViewerTool_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+            splitViewerTool.GetCPDFViewer().UpDateRenderFrame();
+        }
+
+        private void RemoveSplitViewerTool()
+        {
+            PDFViewTool.GetCPDFViewer().UpDateRenderFrame();
+            VerticalSplitter.Visibility = Visibility.Collapsed;
+            HorizontalSplitter.Visibility = Visibility.Collapsed;
+            VerticalView.Visibility = Visibility.Collapsed;
+            HorizontalView.Visibility = Visibility.Collapsed;
+            ViewToolGrid.ColumnDefinitions[1].Width = new GridLength(0);
+            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;
+        }
+
+        private void PDFView_GotFocus(object sender, RoutedEventArgs e)
+        {
+            switch((sender as Border).Tag)
+            {
+                case "ViewerTool":
+                    SelectedPDFViewTool = viewerTool;
+                    break;
+                case "SplitViewerTool":
+                    SelectedPDFViewTool = splitViewerTool;
+                    break;
+            }
+            SelectedPDFViewToolChanged?.Invoke(this,EventArgs.Empty);
+        }
+
         #region Private Command Methods
         private double CheckZoomLevel(double zoom, bool IsGrowth)
         {
@@ -110,8 +295,7 @@ namespace Compdfkit_Tools.PDFControl
             }
             return standardZoom / 100;
         }
-        #endregion
-
 
+        #endregion
     }
 }

+ 10 - 2
Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml.cs

@@ -15,7 +15,7 @@ namespace Compdfkit_Tools.PDFView
 {
     public partial class RegularViewerControl : UserControl, INotifyPropertyChanged
     {
-        public PDFViewControl PdfViewControl = new PDFViewControl();
+        public PDFViewControl PdfViewControl;
         public CPDFAnnotationControl PDFAnnotationControl = new CPDFAnnotationControl();
         private SignatureStatusBarControl signatureStatusBarControl;
         private CPDFDisplaySettingsControl displaySettingsControl = null;
@@ -99,6 +99,8 @@ 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; 
@@ -106,7 +108,13 @@ namespace Compdfkit_Tools.PDFView
             PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
             //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;

+ 31 - 18
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -130,6 +130,13 @@ 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>
@@ -173,9 +180,15 @@ namespace PDFViewer
                 LoadCustomControl();
                 panelState.PropertyChanged -= PanelState_PropertyChanged;
                 panelState.PropertyChanged += PanelState_PropertyChanged;
+                displaySettingsControl.SplitModeChanged += DisplaySettingsControl_SplitModeChanged;
             }
         }
 
+        private void DisplaySettingsControl_SplitModeChanged(object sender, Compdfkit_Tools.PDFControlUI.CPDFViewModeUI.SplitMode e)
+        {
+            viewControl.SetSplitViewMode(e);
+        }
+
         /// <summary>
         /// When the RightPanel state is changed, decide whether to display the ViewSettingPanel or RightToolPanel.
         /// </summary>
@@ -326,13 +339,13 @@ namespace PDFViewer
             {
                 annotationControl.UnloadEvent();
                 annotationControl.ClearViewerControl();
-                viewControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(false);
+                viewControl.SetIsShowStampMouse(false);
             }
             else if (currentMode == "Form")
             {
                 formControl.UnloadEvent();
                 formControl.ClearViewerControl();
-                viewControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(false);
+                viewControl.SetIsShowStampMouse(false);
             }
             else if (currentMode == "Content Editor")
             {
@@ -348,13 +361,13 @@ namespace PDFViewer
 
             if (item.Content as string == "Viewer")
             {
+                regularViewerControl.PdfViewControl = viewControl;
+                regularViewerControl.InitWithPDFViewer(viewControl);
                 if (regularViewerControl.PdfViewControl != null)
                 {
                     PDFGrid.Child = regularViewerControl;
-                    viewControl.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.Viewer);
+                    viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.Viewer);
                     //viewControl.PDFView.SetMouseMode(MouseModes.Viewer);
-                    regularViewerControl.PdfViewControl = viewControl;
-                    regularViewerControl.InitWithPDFViewer(viewControl);
                     regularViewerControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
                     regularViewerControl.OnCanSaveChanged += ControlOnCanSaveChanged;
                     regularViewerControl.SetBOTAContainer(botaBarControl);
@@ -364,15 +377,15 @@ namespace PDFViewer
             else if (item.Content as string == "Annotation")
             {
                 annotationControl.SetToolBarContainerVisibility(Visibility.Visible);
+                PDFGrid.Child = annotationControl;
+
+                viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.CreateAnnot);
+                //viewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                //annotationControl.PDFViewControl.PDFView.SetToolParam(new AnnotHandlerEventArgs());
+                annotationControl.PDFViewControl = viewControl;
+                annotationControl.InitWithPDFViewer(viewControl);
                 if (annotationControl.PDFViewControl != null)
                 {
-                    PDFGrid.Child = annotationControl;
-
-                    viewControl.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.CreateAnnot);
-                    //viewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-                    //annotationControl.PDFViewControl.PDFView.SetToolParam(new AnnotHandlerEventArgs());
-                    annotationControl.PDFViewControl = viewControl;
-                    annotationControl.InitWithPDFViewer(viewControl);
                     annotationControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
                     annotationControl.OnCanSaveChanged += ControlOnCanSaveChanged;
                     annotationControl.OnAnnotEditHandler -= PdfFormControlRefreshAnnotList;
@@ -385,12 +398,12 @@ namespace PDFViewer
             else if (item.Content as string == "Form")
             {
                 formControl.SetToolBarContainerVisibility(Visibility.Visible);
+                formControl.PdfViewControl = viewControl;
+                formControl.InitWithPDFViewer(viewControl);
                 if (formControl.PdfViewControl != null )
                 {
                     PDFGrid.Child = formControl;
-                    viewControl.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
-                    formControl.PdfViewControl = viewControl;
-                    formControl.InitWithPDFViewer(viewControl);
+                    viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.FormEdit);
                     formControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
                     formControl.OnCanSaveChanged += ControlOnCanSaveChanged;
                     formControl.OnAnnotEditHandler -= PdfFormControlRefreshAnnotList;
@@ -402,6 +415,8 @@ namespace PDFViewer
             }
             else if (item.Content as string == "Content Editor")
             {
+                contentEditControl.PdfViewControl = viewControl;
+                contentEditControl.InitWithPDFViewer(viewControl);
                 if (contentEditControl.pdfContentEditControl != null && contentEditControl.PdfViewControl!= null)
                 {
                     //viewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
@@ -410,9 +425,7 @@ namespace PDFViewer
                     //viewControl.PDFView?.ReloadDocument();
 
                     PDFGrid.Child = contentEditControl;
-                    viewControl.PDFToolManager.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.ContentEdit);
-                    contentEditControl.PdfViewControl = viewControl;
-                    contentEditControl.InitWithPDFViewer(viewControl);
+                    viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.ContentEdit);
                     contentEditControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
                     contentEditControl.OnCanSaveChanged += ControlOnCanSaveChanged;
                     contentEditControl.SetBOTAContainer(botaBarControl);

+ 10 - 3
Demo/Examples/PDFViewer/MainWindow.xaml.cs

@@ -30,7 +30,6 @@ namespace PDFViewer
     {
         #region Property
         private PDFViewControl passwordViewer;
-        private PDFViewControl pdfViewControl = new PDFViewControl();
         private string[] oldAndNewFilePath;
 
         #endregion
@@ -160,7 +159,6 @@ namespace PDFViewer
                     PasswordUI.ClearPassword();
                     PasswordUI.Visibility = Visibility.Collapsed;
                     PopupBorder.Visibility = Visibility.Collapsed;
-                    pdfViewControl = passwordViewer;
 
                     string filePath = pdfDoc.FilePath;
                     TabItemExt tabItem = new TabItemExt();
@@ -171,7 +169,7 @@ namespace PDFViewer
                     tabItem.FileName = Path.GetFileName(filePath);
                     tabItem.Tag = filePath;
 
-                    viewPage.SetPDFViewer(pdfViewControl);
+                    viewPage.SetPDFViewer(passwordViewer);
                     App.OpenedFilePathList.Add(filePath);
 
                     TabControl.Items.Add(tabItem);
@@ -287,6 +285,15 @@ namespace PDFViewer
             {
                 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
             }
+
+            //protected override void OnSelected(RoutedEventArgs e)
+            //{
+            //    string filePath = Tag?.ToString();
+            //    if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
+            //    {
+            //        this.IsSelected = true;
+            //    }
+            //}
         }
 
         private DragablzItem FindParentDragablzItem(DependencyObject element)