瀏覽代碼

Fixes NumericUpDown resize when number of characters grows.

BDisp 1 年之前
父節點
當前提交
8c617f33f7
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      UICatalog/Scenarios/Buttons.cs

+ 2 - 2
UICatalog/Scenarios/Buttons.cs

@@ -420,7 +420,7 @@ public class Buttons : Scenario
 
             // TODO: Use Dim.Auto for the Width and Height
             Height = 1;
-            Width = Dim.Func (() => Digits + 2); // button + 3 for number + button
+            Width = Dim.Func (() => _number is null ? Digits + 2 : Math.Max (Digits + 2, _number.Text.Length + 2)); // button + 3 for number + button
 
             _down = new ()
             {
@@ -438,7 +438,7 @@ public class Buttons : Scenario
                 Text = Value.ToString (),
                 X = Pos.Right (_down),
                 Y = Pos.Top (_down),
-                Width = Dim.Func (() => Digits),
+                Width = Dim.Func (() => _number is null ? Digits : Math.Max (Digits, _number.Text.Length)),
                 Height = 1,
                 TextAlignment = TextAlignment.Centered,
                 CanFocus = true