瀏覽代碼

其他 - 修改步进器控件逻辑,修复控件仅显示固定初始值的问题

ZhouJieSheng 1 年之前
父節點
當前提交
5d4977c8ad
共有 2 個文件被更改,包括 9 次插入5 次删除
  1. 1 0
      .gitignore
  2. 8 5
      PDF Office/CustomControl/NumericUpDown.xaml.cs

+ 1 - 0
.gitignore

@@ -8,3 +8,4 @@ PDFSettings/bin/
 *.htm
 PDF Office/SDKLisence.xml
 PDF Master-cache/
+Prerequisites/

+ 8 - 5
PDF Office/CustomControl/NumericUpDown.xaml.cs

@@ -21,7 +21,7 @@ namespace PDF_Master.CustomControl
     /// </summary>
     public partial class NumericUpDown : UserControl
     {
-        
+
 
         public string Text
         {
@@ -68,6 +68,7 @@ namespace PDF_Master.CustomControl
             if (control != null)
             {
                 control.TextBox_Num.Text = Convert.ToString(value);
+
             }
         }
         /// <summary>
@@ -90,7 +91,8 @@ namespace PDF_Master.CustomControl
         public double Minimum
         {
             get { return (double)GetValue(MinimumProperty); }
-            set { 
+            set
+            {
                 SetValue(MinimumProperty, value);
             }
         }
@@ -166,7 +168,7 @@ namespace PDF_Master.CustomControl
                 targetvalue = Minimum;
             }
 
-            if(targetvalue<Minimum)
+            if (targetvalue < Minimum)
             {
                 targetvalue = Minimum;
             }
@@ -219,9 +221,10 @@ namespace PDF_Master.CustomControl
 
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
-            if (string.IsNullOrEmpty(Text))
+            //修复控件初始化显示固定值的问题
+            if (Value >= Minimum)
             {
-            Text = Minimum.ToString();
+                Text = Value.ToString();
             }
         }
     }