Bladeren bron

属性面板 - 优化形状注释

chenrongqian 2 jaren geleden
bovenliggende
commit
3bbd497ed2

+ 16 - 5
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SharpsAnnotPropertyViewModel.cs

@@ -28,7 +28,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             if (value is DashStyle)
             {
                 var dash = value as DashStyle;
-                if (dash.Dashes.Count == 0 || dash.Dashes[0] == 0)
+                if (dash.Dashes == null || dash.Dashes.Count == 0 || dash.Dashes[0] == 0)
                 {
                    return DashStyles.Solid.Dashes; 
                 }
@@ -151,15 +151,23 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             set
             {
                 SetProperty(ref dash, value);
-                if(dash.Dashes[0] == 0)
+                if(dash.Dashes != null && dash.Dashes.Count > 0)
                 {
-                    AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, DashStyles.Solid);
+                    if (dash.Dashes[0] == 0)
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, DashStyles.Solid);
+                    }
+                    else
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, dash);
+                    }
+
                 }
                 else
                 {
-                    AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, dash);
+                    AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, DashStyles.Solid);
                 }
-                
+
                 AnnotEvent?.UpdateAnnot();
             }
         }
@@ -426,6 +434,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                             BorderOpacity = Square.Transparency;
                             FillOpacity = Square.Transparency;
                             LineWidth = Square.LineWidth;
+                            Dash = Square.LineDash;
                             SharpsType("Rect",true);
                             
                         }
@@ -440,6 +449,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                             BorderOpacity = Circle.Transparency;
                             FillOpacity = Circle.Transparency;
                             LineWidth = Circle.LineWidth;
+                            Dash = Circle.LineDash;
                             SharpsType("Circle", true);
                         }
                         break;
@@ -453,6 +463,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                             BorderOpacity = line.Transparency;
                             FillOpacity = line.Transparency;
                             LineWidth = line.LineWidth;
+                            Dash = line.LineDash;
 
                             if (line.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && line.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
                                 SharpsType("Arrow", true);

+ 20 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml.cs

@@ -51,6 +51,8 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
                             cusFillColor.SetSelectedColor(annot.BgColor);
                             layerFill.SetSliOpacity(annot.Transparency);
                             SharpsBtn_Click(SharpRectBtn, null);
+
+                            SolidLineIschecked(annot.LineDash.Dashes == null || annot.LineDash.Dashes.Count == 0 || annot.LineDash.Dashes[0] == 0);
                         }
                         break;
                     }
@@ -64,6 +66,8 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
                             cusFillColor.SetSelectedColor(annot.BgColor);
                             layerFill.SetSliOpacity(annot.Transparency);
                             SharpsBtn_Click(SharpCircleBtn, null);
+
+                            SolidLineIschecked(annot.LineDash.Dashes == null || annot.LineDash.Dashes.Count == 0 || annot.LineDash.Dashes[0] == 0);
                         }
                         break;
                     }
@@ -82,12 +86,28 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
                             else
                                 SharpsBtn_Click(SharpLineBtn, null);
 
+                            SolidLineIschecked(annot.LineDash.Dashes == null || annot.LineDash.Dashes.Count == 0 || annot.LineDash.Dashes[0] == 0);
+
                         }
                         break;
                     }
             }
         }
 
+        private void SolidLineIschecked(bool isSolid)
+        {
+            if (isSolid)
+            {
+                BtnSolidLine.IsChecked = true;
+                BtnDottedLine.IsChecked = false;
+            }
+            else
+            {
+                BtnDottedLine.IsChecked = true;
+                BtnSolidLine.IsChecked = false;
+            }
+        }
+
         private void layerFill_SelectedValue(object sender, double e)
         {
             if (ViewModel != null)