Ver Fonte

注释 - 补充所有注释的属性默认值,右键菜单填充颜色、边框颜色,对齐,字体

chenrongqian@kdanmobile.com há 2 anos atrás
pai
commit
d33574cc63

+ 52 - 0
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -428,6 +428,9 @@ namespace PDF_Office.ViewModels.Tools
                             {
                                 var selectedAnnot = e.AnnotEventArgsList[0];
                                 PopMenuCheckedLineDash(selectedAnnot);
+                                PopMenuCheckedFontFamily(selectedAnnot);
+                                PopMenuCheckedTextAglin(selectedAnnot);
+
                                 switch (selectedAnnot.EventType)
                                 {
                                     case AnnotArgsType.AnnotHighlight:
@@ -461,10 +464,12 @@ namespace PDF_Office.ViewModels.Tools
                                     case AnnotArgsType.AnnotSquare:
                                     case AnnotArgsType.AnnotCircle:
                                         ShapeAnnotPopMenu.SetVisual("ShapeDirect", false);
+                                        ShapeAnnotPopMenu.SetVisual("ShapeFillColor", true);
                                         e.PopupMenu = ShapeAnnotPopMenu.OpenMenu(selectedAnnot, sender);
                                         break;
 
                                     case AnnotArgsType.AnnotLine:
+                                        ShapeAnnotPopMenu.SetVisual("ShapeFillColor", false);
                                         ShapeAnnotPopMenu.SetVisual("ShapeDirect", true);
                                         e.PopupMenu = ShapeAnnotPopMenu.OpenMenu(selectedAnnot, sender);
                                         break;
@@ -526,6 +531,53 @@ namespace PDF_Office.ViewModels.Tools
             }
         }
 
+        //右键菜单,选中字体样式按钮状态
+        private void PopMenuCheckedFontFamily(AnnotHandlerEventArgs annot)
+        {
+            if (annot != null)
+            {
+                if (annot.EventType == AnnotArgsType.AnnotFreeText)
+                {
+                    var freeText = annot as FreeTextAnnotArgs;
+                    FreeTextAnnotPopMenu.SetIsChecked(freeText.FontFamily.ToString(), true);
+                }
+            }
+        }
+
+        //右键菜单,选中文本内容对齐按钮状态
+        private void PopMenuCheckedTextAglin(AnnotHandlerEventArgs annot)
+        {
+            if (annot != null)
+            {
+                if (annot.EventType == AnnotArgsType.AnnotFreeText)
+                {
+                    var freeText = annot as FreeTextAnnotArgs;
+                    switch(freeText.Align)
+                    {
+                        case TextAlignment.Left:
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinLeft", true);
+                            break;
+                        case TextAlignment.Center:
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinCenter", true);
+                            break;
+                        case TextAlignment.Right:
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinRight", true);
+                            break;
+                        case TextAlignment.Justify:
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinJustify", true);
+                            break;
+                        default:
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinLeft", false);
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinCenter", false);
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinRight", false);
+                            FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinJustify", false);
+                            break;
+                    }
+
+                }
+            }
+        }
+
         //右键菜单,选中虚实线按钮状态
         private void PopMenuCheckedLineDash(AnnotHandlerEventArgs annot)
         {

+ 188 - 24
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -275,12 +275,13 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = highlightArgs.EventType;
                     defaultAnnot.ForgoundColor = (highLightColor as SolidColorBrush).Color;
                     defaultAnnot.Opacity = 1;
                     Settings.Default.Save();
                 }
 
-                highlightArgs.Transparency = defaultAnnot.Opacity;
+                highLightOpacity = highlightArgs.Transparency = defaultAnnot.Opacity;
 
                 selectedArgs = new List<AnnotHandlerEventArgs>();
                 selectedArgs.Add(highlightArgs);
@@ -340,12 +341,13 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = underlineArgs.EventType;
                     defaultAnnot.ForgoundColor = (UnderLineColor as SolidColorBrush).Color;
                     defaultAnnot.Opacity = 1;
                     Settings.Default.Save();
                 }
 
-                underlineArgs.Transparency = defaultAnnot.Opacity;
+                UnderLineOpacity = underlineArgs.Transparency = defaultAnnot.Opacity;
 
                 selectedArgs = new List<AnnotHandlerEventArgs>();
                 selectedArgs.Add(underlineArgs);
@@ -378,12 +380,14 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = squigglyArgs.EventType;
                     defaultAnnot.ForgoundColor = (squigglyColor as SolidColorBrush).Color;
                     defaultAnnot.Opacity = 1;
                     Settings.Default.Save();
                 }
 
-                squigglyArgs.Transparency = defaultAnnot.Opacity;
+                SquigglyOpacity = squigglyArgs.Transparency = defaultAnnot.Opacity;
+                
 
                 selectedArgs = new List<AnnotHandlerEventArgs>();
                 selectedArgs.Add(squigglyArgs);
@@ -416,6 +420,7 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = strikeoutArgs.EventType;
                     defaultAnnot.ForgoundColor = (strikeoutColor as SolidColorBrush).Color;
                     defaultAnnot.Opacity = 1;
                     Settings.Default.Save();
@@ -461,6 +466,7 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = freehandArgs.EventType;
                     defaultAnnot.ForgoundColor = annotate.FreeHandColor;
                     defaultAnnot.Opacity = 1;
                     Settings.Default.Save();
@@ -469,6 +475,20 @@ namespace PDF_Office.ViewModels.Tools
                 freehandArgs.Transparency = defaultAnnot.Opacity;
                 freehandArgs.LineWidth = defaultAnnot.Thickness;
 
+                if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
+                {
+                    freehandArgs.LineDash = DashStyles.Solid;
+                }
+                else
+                {
+                    var collect = new DoubleCollection();
+                    foreach (var item in defaultAnnot.DashArray)
+                    {
+                        collect.Add(item);
+                    }
+                    freehandArgs.LineDash.Dashes = collect;
+                }
+
                 selectedArgs = new List<AnnotHandlerEventArgs>();
                 selectedArgs.Add(freehandArgs);
             }
@@ -509,6 +529,7 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = freetextArgs.EventType;
                     defaultAnnot.ForgoundColor = freetextArgs.FontColor;
                     defaultAnnot.BorderColor = Colors.Transparent;
                     defaultAnnot.BackgroundColor = Colors.Transparent;
@@ -585,6 +606,7 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = stickyAnnotArgs.EventType;
                     defaultAnnot.NoteText = string.Empty;
                     defaultAnnot.Opacity = 1;
                     Settings.Default.Save();
@@ -639,6 +661,7 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = squareArgs.EventType;
                     defaultAnnot.Thickness = 1;
                     defaultAnnot.Opacity = 1;
                     Settings.Default.Save();
@@ -646,7 +669,20 @@ namespace PDF_Office.ViewModels.Tools
 
                 squareArgs.LineWidth = defaultAnnot.Thickness;
                 squareArgs.Transparency = defaultAnnot.Opacity;
-                squareArgs.LineDash = DashStyles.Solid;
+
+                if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
+                {
+                    squareArgs.LineDash = DashStyles.Solid;
+                }
+                else
+                {
+                    var collect = new DoubleCollection();
+                    foreach (var item in defaultAnnot.DashArray)
+                    {
+                        collect.Add(item);
+                    }
+                    squareArgs.LineDash.Dashes = collect;
+                }
 
                 if (squareArgs != null)
                 {
@@ -691,15 +727,31 @@ namespace PDF_Office.ViewModels.Tools
                 if (defaultAnnot == null)
                 {
                     defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = circleAnnotArgs.EventType;
                     defaultAnnot.Thickness = 1;
                     defaultAnnot.Opacity = 1;
                     defaultAnnot.NoteText = string.Empty;
+                    defaultAnnot.DashArray = null;
                     Settings.Default.Save();
                 }
 
                 circleAnnotArgs.LineWidth = defaultAnnot.Thickness;
                 circleAnnotArgs.Transparency = defaultAnnot.Opacity;
-                circleAnnotArgs.LineDash = DashStyles.Solid;
+
+                if(defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
+                {
+                    circleAnnotArgs.LineDash = DashStyles.Solid;
+                }
+                else
+                {
+                    var collect = new DoubleCollection();
+                    foreach(var item in defaultAnnot.DashArray)
+                    {
+                        collect.Add(item);
+                    }
+                    circleAnnotArgs.LineDash.Dashes = collect;
+                }
+                
 
                 if (circleAnnotArgs != null)
                 {
@@ -747,10 +799,37 @@ namespace PDF_Office.ViewModels.Tools
                 {
                     lineArgs.TailLineType = C_LINE_TYPE.LINETYPE_ARROW;
                 }
+
+                var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(lineArgs.EventType);
+                if (defaultAnnot == null)
+                {
+                    defaultAnnot = new DefaultAnnotProperty();
+                    defaultAnnot.AnnotToolType = lineArgs.EventType;
+                    defaultAnnot.Thickness = 1;
+                    defaultAnnot.Opacity = 1;
+                    defaultAnnot.NoteText = string.Empty;
+                    defaultAnnot.DashArray = null;
+                    Settings.Default.Save();
+                }
+
                 lineArgs.LineDash = DashStyles.Solid;
-                lineArgs.LineWidth = 1;
-                lineArgs.Transparency = 1;
-                lineArgs.Content = string.Empty;
+                lineArgs.LineWidth = defaultAnnot.Thickness;
+                lineArgs.Transparency = defaultAnnot.Opacity;
+
+                if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
+                {
+                    lineArgs.LineDash = DashStyles.Solid;
+                }
+                else
+                {
+                    var collect = new DoubleCollection();
+                    foreach (var item in defaultAnnot.DashArray)
+                    {
+                        collect.Add(item);
+                    }
+                    lineArgs.LineDash.Dashes = collect;
+                }
+
 
                 if (lineArgs != null)
                 {
@@ -1131,16 +1210,31 @@ namespace PDF_Office.ViewModels.Tools
                     }
                     else if (annot is FreehandAnnotArgs)
                     {
-                        var color = (annot as FreehandAnnotArgs).InkColor;
+                        var freeHand = annot as FreehandAnnotArgs;
+                        var color = freeHand.InkColor;
 
                         Settings.Default.AppProperties.Annotate.FreeHandColor = color;
 
-                        var Freehand = GetAnnotDefault(AnnotArgsType.AnnotFreehand);
-                        Freehand.ForgoundColor = color;
-                        Freehand.Opacity = (annot as FreehandAnnotArgs).Transparency;
-                        Freehand.Thickness = (annot as FreehandAnnotArgs).LineWidth;
+                        var FreehandDefault = GetAnnotDefault(AnnotArgsType.AnnotFreehand);
+                        FreehandDefault.ForgoundColor = color;
+                        FreehandDefault.Opacity = freeHand.Transparency;
+                        FreehandDefault.Thickness = freeHand.LineWidth;
+
+                        var isSolid = AnnotPropertyPanel.IsSolidStyle(freeHand.LineDash);
+                        if (isSolid)
+                        {
+                            FreehandDefault.DashArray = null;
+                        }
+                        else
+                        {
+                            FreehandDefault.DashArray = new List<double>();
+                            foreach (var item in freeHand.LineDash.Dashes)
+                            {
+                                FreehandDefault.DashArray.Add(item);
+                            }
+                        }
 
-                        SettingHelper.SetAnnotDefaultProperty(Freehand);
+                        SettingHelper.SetAnnotDefaultProperty(FreehandDefault);
                     }
                     else if (annot is FreeTextAnnotArgs)
                     {
@@ -1166,42 +1260,94 @@ namespace PDF_Office.ViewModels.Tools
                         Settings.Default.AppProperties.Annotate.NoteAnnoteColor = color;
                         var StickyDefalut = GetAnnotDefault(AnnotArgsType.AnnotSticky);
                         StickyDefalut.ForgoundColor = color;
+
                         SettingHelper.SetAnnotDefaultProperty(StickyDefalut);
                     }
                     else if (annot is SquareAnnotArgs)
                     {
-                        var bgColor = (annot as SquareAnnotArgs).BgColor;
+                        var square = annot as SquareAnnotArgs;
+                        var bgColor = square.BgColor;
                         Settings.Default.AppProperties.Annotate.RectangleFillColor = bgColor;
-                        var borderColor = (annot as SquareAnnotArgs).LineColor;
+                        var borderColor = square.LineColor;
                         Settings.Default.AppProperties.Annotate.RectangleBorderColor = borderColor;
 
                         var SquareDefalut = GetAnnotDefault(AnnotArgsType.AnnotSquare);
                         SquareDefalut.BorderColor = borderColor;
                         SquareDefalut.BackgroundColor = bgColor;
-                        SquareDefalut.Opacity = (annot as SquareAnnotArgs).Transparency;
+                        SquareDefalut.Opacity = square.Transparency;
+                        SquareDefalut.Thickness = square.LineWidth;
+
+                        var isSolid = AnnotPropertyPanel.IsSolidStyle(square.LineDash);
+                        if (isSolid)
+                        {
+                            SquareDefalut.DashArray = null;
+                        }
+                        else
+                        {
+                            SquareDefalut.DashArray = new List<double>();
+                            foreach (var item in square.LineDash.Dashes)
+                            {
+                                SquareDefalut.DashArray.Add(item);
+                            }
+                        }
+
                         SettingHelper.SetAnnotDefaultProperty(SquareDefalut);
                     }
                     else if (annot is CircleAnnotArgs)
                     {
-                        var bgColor = (annot as CircleAnnotArgs).BgColor;
+                        var circle = annot as CircleAnnotArgs;
+                        var bgColor = circle.BgColor;
                         Settings.Default.AppProperties.Annotate.CircleFillColor = bgColor;
-                        var borderColor = (annot as CircleAnnotArgs).LineColor;
+                        var borderColor = circle.LineColor;
                         Settings.Default.AppProperties.Annotate.CircleBorderColor = borderColor;
 
                         var CircleDefalut = GetAnnotDefault(AnnotArgsType.AnnotCircle);
                         CircleDefalut.BorderColor = borderColor;
                         CircleDefalut.BackgroundColor = bgColor;
-                        CircleDefalut.Opacity = (annot as CircleAnnotArgs).Transparency;
+                        CircleDefalut.Opacity = circle.Transparency;
+                        CircleDefalut.Thickness = circle.LineWidth;
+
+                        var isSolid = AnnotPropertyPanel.IsSolidStyle(circle.LineDash);
+                        if (isSolid)
+                        {
+                            CircleDefalut.DashArray = null;
+                        }
+                        else
+                        {
+                            CircleDefalut.DashArray = new List<double>();
+                            foreach (var item in circle.LineDash.Dashes)
+                            {
+                                CircleDefalut.DashArray.Add(item);
+                            }
+                        }
+
                         SettingHelper.SetAnnotDefaultProperty(CircleDefalut);
                     }
                     else if (annot is LineAnnotArgs)
                     {
+                        var line = (annot as LineAnnotArgs);
                         var color = (annot as LineAnnotArgs).LineColor;
                         Settings.Default.AppProperties.Annotate.LineColor = color;
 
                         var lineDefalut = GetAnnotDefault(AnnotArgsType.AnnotLine);
                         lineDefalut.BorderColor = color;
                         lineDefalut.Opacity = (annot as LineAnnotArgs).Transparency;
+                        lineDefalut.Thickness = (annot as LineAnnotArgs).LineWidth;
+
+                        var isSolid = AnnotPropertyPanel.IsSolidStyle(line.LineDash);
+                        if (isSolid)
+                        {
+                            lineDefalut.DashArray = null;
+                        }
+                        else
+                        {
+                            lineDefalut.DashArray = new List<double>();
+                            foreach (var item in line.LineDash.Dashes)
+                            {
+                                lineDefalut.DashArray.Add(item);
+                            }
+                        }
+
                         SettingHelper.SetAnnotDefaultProperty(lineDefalut);
                     }
 
@@ -1216,6 +1362,7 @@ namespace PDF_Office.ViewModels.Tools
             if (Annot == null)
             {
                 Annot = new DefaultAnnotProperty();
+                Annot.AnnotToolType = annotArgsType;
             }
             return Annot;
         }
@@ -1232,7 +1379,7 @@ namespace PDF_Office.ViewModels.Tools
                 if (annot != null)
                 {
                     var item = new ColorDropBoxPop();
-                    item.DataContext = annot;
+                    item.DataContext = menu;
                     item.ColorSelected -= AnnotMenu_ColorSelected;
                     item.ColorSelected += AnnotMenu_ColorSelected;
 
@@ -1283,7 +1430,10 @@ namespace PDF_Office.ViewModels.Tools
         {
             if (sender != null)
             {
-                var annot = (sender as FrameworkElement).DataContext as AnnotHandlerEventArgs;
+                var menu = (sender as FrameworkElement).DataContext as CusMenuItem;
+                if (menu == null) return;
+
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
                 if (annot != null)
                 {
                     if (annot is FreehandAnnotArgs || annot is StickyAnnotArgs || annot is LineAnnotArgs)
@@ -1295,13 +1445,21 @@ namespace PDF_Office.ViewModels.Tools
                     else if (annot is FreeTextAnnotArgs)
                     {
                         var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
-                        AnnotEvent?.UpdateAttrib(AnnotAttrib.FontColor, e);
+                        if (menu.tag.ToString() == "FontColor")
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.FontColor, e);
+                        else
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
+
                         AnnotEvent?.UpdateAnnot();
                     }
                     else if (annot is SquareAnnotArgs || annot is CircleAnnotArgs)
                     {
                         var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
-                        AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
+                        if (menu.tag.ToString() == "FillColor")
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
+                        else
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, e);
+
                         AnnotEvent?.UpdateAnnot();
                     }
                     else if (annot is TextHighlightAnnotArgs || annot is TextUnderlineAnnotArgs || annot is TextStrikeoutAnnotArgs)
@@ -1311,6 +1469,7 @@ namespace PDF_Office.ViewModels.Tools
                         AnnotEvent?.UpdateAnnot();
                     }
                 }
+             
             }
         }
 
@@ -1421,6 +1580,11 @@ namespace PDF_Office.ViewModels.Tools
                     {
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Right);
                     }
+                    else if (strTag == "Justify")
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Justify);
+                    }
+
                     AnnotEvent?.UpdateAnnot();
                 }
             }

+ 65 - 35
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Layout.cs

@@ -4,6 +4,7 @@ using ComPDFKitViewer.AnnotEvent;
 using PDF_Office.CustomControl;
 using PDF_Office.CustomControl.CompositeControl;
 using PDF_Office.Helper;
+using PDF_Office.Model.PropertyPanel.AnnotPanel;
 using Prism.Mvvm;
 using Prism.Regions;
 using System;
@@ -489,7 +490,8 @@ namespace PDF_Office.ViewModels.Tools
 
             menuItem = new MenuItem();
             menuItem.Name = "FreeHandColor";
-            menuItem.Header = "颜色...";
+            menuItem.Header = "边框颜色";
+            menuItem.Tag = "Color";
             pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
 
             menuItem = new MenuItem();
@@ -558,7 +560,14 @@ namespace PDF_Office.ViewModels.Tools
 
             menuItem = new MenuItem();
             menuItem.Name = "FreeTextColor";
-            menuItem.Header = "颜色...";
+            menuItem.Header = "字体颜色";
+            menuItem.Tag = "FontColor";
+            pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
+
+            menuItem = new MenuItem();
+            menuItem.Name = "FreeTextColor";
+            menuItem.Header = "填充颜色";
+            menuItem.Tag = "FillColor";
             pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
 
             menuItem = new MenuItem();
@@ -566,46 +575,60 @@ namespace PDF_Office.ViewModels.Tools
             menuItem.Header = "字体";
             pop.AddItem(menuItem);
 
-            menuItem = new MenuItem();
-            menuItem.Name = "FreeTextArial";
-            menuItem.Header = "楷体";
-            menuItem.Tag = "Arial";
-            pop.BindingEvent(pop.AddChild("FreeTextFontFamily", menuItem), FreeTextFontFamily_MenuCommand);
-
-            menuItem = new MenuItem();
-            menuItem.Name = "FreeTextCourier";
-            menuItem.Header = "Courier";
-            menuItem.Tag = "Courier";
-            pop.BindingEvent(pop.AddChild("FreeTextFontFamily", menuItem), FreeTextFontFamily_MenuCommand);
+            var family = TextFont.GetFamily();
 
-            menuItem = new MenuItem();
-            menuItem.Name = "FreeTextTimesRoman";
-            menuItem.Header = "Times New Roman";
-            menuItem.Tag = /*"Times New Roman"*/"Times";
-            pop.BindingEvent(pop.AddChild("FreeTextFontFamily", menuItem), FreeTextFontFamily_MenuCommand);
+            foreach (var item in family)
+            {
+                RadioButton familyRdioBtn = new RadioButton();
+                familyRdioBtn.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
+                familyRdioBtn.Background = new SolidColorBrush(Colors.Transparent);
+                familyRdioBtn.Name = item.ValueStr;
+                familyRdioBtn.Tag = item.ValueStr;
+                familyRdioBtn.GroupName = "FontFamily";
+                familyRdioBtn.Content = item.Content;
+                pop.BindingEvent(pop.AddChild("FreeTextFontFamily", familyRdioBtn), FreeTextFontFamily_MenuCommand);
+            }
 
             menuItem = new MenuItem();
             menuItem.Name = "FreeTextAglin";
             menuItem.Header = "文本对齐";
             pop.AddItem(menuItem);
 
-            menuItem = new MenuItem();
-            menuItem.Name = "FreeTextAglinLeft";
-            menuItem.Header = "左对齐";
-            menuItem.Tag = "Left";
-            pop.BindingEvent(pop.AddChild("FreeTextAglin", menuItem), FreeTextAglin_MenuCommand);
+            var radioButton = new RadioButton();
+            radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
+            radioButton.Background = new SolidColorBrush(Colors.Transparent);
+            radioButton.Name = "FreeTextAglinLeft";
+            radioButton.Tag = "Left";
+            radioButton.GroupName = "Aglin";
+            radioButton.Content = "左对齐";
+            pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
 
-            menuItem = new MenuItem();
-            menuItem.Name = "FreeTextAglinCenter";
-            menuItem.Header = "居中对齐";
-            menuItem.Tag = "Center";
-            pop.BindingEvent(pop.AddChild("FreeTextAglin", menuItem), FreeTextAglin_MenuCommand);
+            radioButton = new RadioButton();
+            radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
+            radioButton.Background = new SolidColorBrush(Colors.Transparent);
+            radioButton.Name = "FreeTextAglinCenter";
+            radioButton.Tag = "Center";
+            radioButton.GroupName = "Aglin";
+            radioButton.Content = "居中对齐";
+            pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
 
-            menuItem = new MenuItem();
-            menuItem.Name = "FreeTextAglinRight";
-            menuItem.Header = "右对齐";
-            menuItem.Tag = "Right";
-            pop.BindingEvent(pop.AddChild("FreeTextAglin", menuItem), FreeTextAglin_MenuCommand);
+            radioButton = new RadioButton();
+            radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
+            radioButton.Background = new SolidColorBrush(Colors.Transparent);
+            radioButton.Name = "FreeTextAglinRight";
+            radioButton.Tag = "Right";
+            radioButton.GroupName = "Aglin";
+            radioButton.Content = "右对齐";
+            pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
+
+            radioButton = new RadioButton();
+            radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
+            radioButton.Background = new SolidColorBrush(Colors.Transparent);
+            radioButton.Name = "FreeTextAglinJustify";
+            radioButton.Tag = "Justify";
+            radioButton.GroupName = "Aglin";
+            radioButton.Content = "两端对齐";
+            pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
 
             menuItem = new MenuItem();
             menuItem.Name = "FreeHandDefault";
@@ -645,7 +668,7 @@ namespace PDF_Office.ViewModels.Tools
 
             menuItem = new MenuItem();
             menuItem.Name = "StrickNoteColor";
-            menuItem.Header = "颜色...";
+            menuItem.Header = "颜色";
             pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
 
             menuItem = new MenuItem();
@@ -690,7 +713,14 @@ namespace PDF_Office.ViewModels.Tools
 
             menuItem = new MenuItem();
             menuItem.Name = "ShapeColor";
-            menuItem.Header = "颜色...";
+            menuItem.Header = "边框颜色";
+            menuItem.Tag = "Color";
+            pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
+
+            menuItem = new MenuItem();
+            menuItem.Name = "ShapeFillColor";
+            menuItem.Header = "填充颜色";
+            menuItem.Tag = "FillColor";
             pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
 
             menuItem = new MenuItem();

+ 0 - 3
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs

@@ -11,9 +11,6 @@ using Prism.Regions;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.Tools