Bläddra i källkod

ComPDFKit.Tools(win) - 修复测量属性面板问题

liuaoran 1 vecka sedan
förälder
incheckning
ede9507093

+ 38 - 4
Demo/Examples/Compdfkit.Controls/Measure/Property/PolygonalProperty.xaml.cs

@@ -146,10 +146,10 @@ namespace ComPDFKit.Controls.Measure.Property
                     var fontType = CFontNameHelper.GetFontType(selectItem.Content.ToString());
                     string FontName = CFontNameHelper.ObtainFontName(fontType, polygonMeasureParam.IsBold, polygonMeasureParam.IsItalic);
                     polygonMeasureParam.FontName = FontName;
-                    PolygonMeasureParamChanged?.Invoke(sender, polygonMeasureParam); 
+                    PolygonMeasureParamChanged?.Invoke(sender, polygonMeasureParam);
                 }
                 if (Annotation != null && ViewControl != null)
-                { 
+                {
                     if (selectItem != null && selectItem.Content != null)
                     {
                         CTextAttribute textAttr = Annotation.GetTextAttribute();
@@ -213,7 +213,7 @@ namespace ComPDFKit.Controls.Measure.Property
                     if (Annotation == null)
                     {
                         polygonMeasureParam.FillColor = color;
-                        if(checkBrush.Color != Colors.Transparent)
+                        if (checkBrush.Color != Colors.Transparent)
                         {
                             polygonMeasureParam.HasFillColor = true;
                         }
@@ -225,7 +225,14 @@ namespace ComPDFKit.Controls.Measure.Property
                     }
                     if (Annotation != null && ViewControl != null)
                     {
-                        Annotation.SetBgColor(color);
+                        if (checkBrush.Color == Colors.Transparent)
+                        {
+                            Annotation.ClearBgColor();
+                        }
+                        else
+                        {
+                            Annotation.SetBgColor(color);
+                        }
                         Annotation.UpdateAp();
                         ViewControl.UpdateAnnotFrame();
                     }
@@ -380,6 +387,33 @@ namespace ComPDFKit.Controls.Measure.Property
 
             Color lineColor = Color.FromRgb(param.LineColor[0], param.LineColor[1], param.LineColor[2]);
             BorderColorPickerControl.SetCheckedForColor(lineColor);
+            if(Annotation != null)
+            {
+                if (!Annotation.HasBgColor)
+                {
+                    FillColorPickerControl.SetCheckedForColor(Colors.Transparent);
+                }
+                else
+                {
+                    Color fillColor = Color.FromRgb(param.FillColor[0], param.FillColor[1], param.FillColor[2]);
+                    FillColorPickerControl.SetCheckedForColor(fillColor);
+                }
+            }
+            else
+            {
+                if (!param.HasFillColor)
+                {
+                    FillColorPickerControl.SetCheckedForColor(Colors.Transparent);
+                }
+                else
+                {
+                    Color fillColor = Color.FromRgb(param.FillColor[0], param.FillColor[1], param.FillColor[2]);
+                    FillColorPickerControl.SetCheckedForColor(fillColor);
+                }
+            }
+            Color FontColor = Color.FromRgb(param.FontColor[0], param.FontColor[1], param.FontColor[2]);    
+            FontColorPickerControl.SetCheckedForColor(FontColor);
+
             if (polygonMeasureParam.BorderStyle == C_BORDER_STYLE.BS_SOLID)
             {
                 CPDFLineStyleControl.DashStyle = DashStyles.Solid;