浏览代码

文本编辑-每个字体需要按照字体的样式显示

OYXH\oyxh 1 年之前
父节点
当前提交
c800558dc1

+ 1 - 0
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml

@@ -28,6 +28,7 @@
                     <TextBlock
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
+                        FontFamily="{Binding FontFamily}"
                         Text="{Binding Content}" />
                 </StackPanel>
             </DataTemplate>

+ 15 - 10
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml.cs

@@ -64,8 +64,16 @@ namespace PDF_Master.CustomControl.CompositeControl
             get { return _content; }
             private set { SetProperty(ref _content, value); }
         }
-
-        //下拉框显示的内容+单位:限数字值的单位
+
+        private FontFamily fontFamily = new FontFamily("Arial");
+
+        public FontFamily FontFamily
+        {
+            get { return fontFamily; }
+            set { SetProperty(ref fontFamily, value); }
+        }
+
+        //下拉框显示的内容+单位:限数字值的单位
         public string Unit { get; private set; }
 
         //数字类型
@@ -351,8 +359,7 @@ namespace PDF_Master.CustomControl.CompositeControl
                             index = control.Items.IndexOf(temp);
 
                         if (index >= 0)
-                        {
-
+                        {
                             //为了改变值时选项跟着改变,但是值并没有时时刻刻改变,且影响其他事件展示注释掉 2023/4/4
                             //if (control.SelectedIndex != index)
                             //{
@@ -399,22 +406,20 @@ namespace PDF_Master.CustomControl.CompositeControl
             {
                 //删掉了selectedIndex != -1,设置不选中任何选项的情况
                 //删掉了control.SelectedItems = null;避免崩溃
-                if (control.comBox.Items != null && control.comBox.Items.Count > 0 )
+                if (control.comBox.Items != null && control.comBox.Items.Count > 0)
                 {
                     control.comBox.SelectedIndex = selectedIndex;
                     if (control.comBox.SelectedItem != null)
                     {
-                        if(control.comBox.SelectedItem is ComboDataItem comboDataItem)
+                        if (control.comBox.SelectedItem is ComboDataItem comboDataItem)
                         {
                             bool isEqual = EqualityComparer<ComboDataItem>.Default.Equals(comboDataItem, control.SelectedItems);
-                            if (isEqual==false)
+                            if (isEqual == false)
                             {
                                 control.SelectedItems = (ComboDataItem)control.comBox.SelectedItem;
                             }
                         }
-                    }
-                        
-                  
+                    }
                 }
                 control.UpdateSelectedIndex();
             }

+ 4 - 1
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -1,4 +1,5 @@
-using PDF_Master.CustomControl.CompositeControl;
+using ImTools;
+using PDF_Master.CustomControl.CompositeControl;
 using PDF_Master.Helper;
 using PDF_Master.Model.AnnotPanel;
 using PDF_Master.Properties;
@@ -10,6 +11,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
+using System.Windows.Controls;
 using System.Windows.Media;
 
 namespace PDF_Master.Model.PropertyPanel.AnnotPanel
@@ -375,6 +377,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                     continue;
                 }
                 item = new ComboDataItem(DeleteCharacters(itemFam), content);
+                item.FontFamily = new FontFamily(content);
                 FontFamilyItems.Add(item);
             }
             return FontFamilyItems;

+ 1 - 1
PDF Office/PDF Master.csproj.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <ProjectView>ShowAllFiles</ProjectView>
+    <ProjectView>ProjectFiles</ProjectView>
   </PropertyGroup>
 </Project>