Browse Source

compdfkit(win) - 注释第一次创建初始化颜色

liuaoran 1 year ago
parent
commit
fcfc639c74

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreeTextUI.xaml.cs

@@ -24,6 +24,7 @@ namespace Compdfkit_Tools.PDFControlUI
             CPDFFontControl.FontAlignChanged += CPDFFontControl_FontAlignChanged;
             CPDFFontControl.FontSizeChanged += CPDFFontControl_FontSizeChanged;
             CPDFAnnotationPreviewerControl.DrawFreeTextPreview(GetFreeTextData());
+            ColorPickerControl.SetCheckedForColor(GetFreeTextData().BorderColor);
         }
 
         private void CPDFFontControl_FontSizeChanged(object sender, EventArgs e)

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

@@ -21,8 +21,10 @@ namespace Compdfkit_Tools.PDFControlUI
             ColorPickerControl.ColorChanged += ColorPickerControl_ColorChanged;
             CPDFOpacityControl.OpacityChanged += CPDFOpacityControl_OpacityChanged;
             CPDFThicknessControl.ThicknessChanged += CPDFThicknessControl_ThicknessChanged;
-            CPDFAnnotationPreviewerControl.DrawFreehandPreview(GetFreehandData());
             EraseThickness.ThicknessChanged += EraseThickness_ThicknessChanged;
+
+            CPDFAnnotationPreviewerControl.DrawFreehandPreview(GetFreehandData());
+            ColorPickerControl.SetCheckedForColor(GetFreehandData().BorderColor);
         }
 
         private void EraseThickness_ThicknessChanged(object sender, EventArgs e)

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFMarkupUI.xaml.cs

@@ -19,6 +19,7 @@ namespace Compdfkit_Tools.PDFControlUI
             InitializeComponent();
             ColorPickerControl.ColorChanged += ColorPickerControl_ColorChanged;
             CPDFOpacityControl.OpacityChanged += CPDFOpacityControl_OpacityChanged;
+            ColorPickerControl.SetCheckedForColor(GetMarkupData().Color);
         }
 
         private void CPDFOpacityControl_OpacityChanged(object sender, EventArgs e)

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFNoteUI.xaml.cs

@@ -18,6 +18,7 @@ namespace Compdfkit_Tools.PDFControlUI
             InitializeComponent();
             ColorPickerControl.ColorChanged += ColorPickerControl_ColorChanged;
             CPDFAnnotationPreviewerControl.DrawNotePreview(GetNoteData());
+            ColorPickerControl.SetCheckedForColor(GetNoteData().BorderColor);
         }
 
         private void ColorPickerControl_ColorChanged(object sender, EventArgs e)

+ 16 - 2
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFShapeUI.xaml.cs

@@ -27,6 +27,7 @@ namespace Compdfkit_Tools.PDFControlUI
             CPDFLineStyleControl.LineStyleChanged += CPDFLineStyleControl_LineStyleChanged;
 
             CPDFAnnotationPreviewerControl.DrawShapePreview(GetShapeData());
+           
         }
 
         private void BorderColorPickerControl_ColorChanged(object sender, EventArgs e)
@@ -243,8 +244,7 @@ namespace Compdfkit_Tools.PDFControlUI
             }
             CPDFArrowControl.LineType = lineType;
         }
-
-
+         
         public void InitWithAnnotationType(CPDFAnnotationType annotationType)
         {
             currentAnnotationType = annotationType;
@@ -252,24 +252,38 @@ namespace Compdfkit_Tools.PDFControlUI
             {
                 case CPDFAnnotationType.Square:
                     TitleTextBlock.Text = "Rectangle";
+                    currentAnnotationType = CPDFAnnotationType.Square;
                     InitWhenRectAndRound();
                     break;
                 case CPDFAnnotationType.Circle:
                     TitleTextBlock.Text = "Circle";
+                    currentAnnotationType = CPDFAnnotationType.Circle; 
                     InitWhenRectAndRound();
                     break;
                 case CPDFAnnotationType.Arrow:
                     TitleTextBlock.Text = "Arrow";
+                    currentAnnotationType= CPDFAnnotationType.Arrow;
                     InitWhenArrowAndLine();
                     break;
                 case CPDFAnnotationType.Line:
                     TitleTextBlock.Text = "Line";
+                    currentAnnotationType = CPDFAnnotationType.Line;
                     InitWhenArrowAndLine();
                     break;
                 default:
                     throw new ArgumentException("Not Excepted Argument");
             }
             CPDFAnnotationPreviewerControl.DrawShapePreview(GetShapeData());
+            if (currentAnnotationType == CPDFAnnotationType.Circle || currentAnnotationType == CPDFAnnotationType.Square)
+            {
+                BorderColorPickerControl.SetCheckedForColor((GetShapeData() as CPDFShapeData).BorderColor);
+                FillColorPickerControl.SetCheckedForColor((GetShapeData() as CPDFShapeData).FillColor);
+
+            }
+            else if (currentAnnotationType == CPDFAnnotationType.Line || currentAnnotationType == CPDFAnnotationType.Arrow)
+            {
+                BorderColorPickerControl.SetCheckedForColor((GetShapeData() as CPDFLineShapeData).BorderColor);
+            }
         }
     }
 }