Loading...
Loading...
Compare original and translation side by side
using Syncfusion.Windows.Forms.Tools;
// Add assembly reference: Syncfusion.Shared.Base
// Include namespace: Syncfusion.Windows.Forms.Tools
// Create and add control
IntegerTextBox integerTextBox1 = new IntegerTextBox();
this.Controls.Add(integerTextBox1);
// Set constraints
integerTextBox1.MaxValue = 999999;
integerTextBox1.MinValue = -999999;
integerTextBox1.IntegerValue = 0;using Syncfusion.Windows.Forms.Tools;
// Add assembly reference: Syncfusion.Shared.Base
// Include namespace: Syncfusion.Windows.Forms.Tools
// Create and add control
IntegerTextBox integerTextBox1 = new IntegerTextBox();
this.Controls.Add(integerTextBox1);
// Set constraints
integerTextBox1.MaxValue = 999999;
integerTextBox1.MinValue = -999999;
integerTextBox1.IntegerValue = 0;integerTextBox1.PositiveColor = System.Drawing.Color.Green;
integerTextBox1.NegativeColor = System.Drawing.Color.Red;
integerTextBox1.ZeroColor = System.Drawing.Color.Gray;integerTextBox1.PositiveColor = System.Drawing.Color.Green;
integerTextBox1.NegativeColor = System.Drawing.Color.Red;
integerTextBox1.ZeroColor = System.Drawing.Color.Gray;integerTextBox1.NumberGroupSeparator = ",";
integerTextBox1.NumberGroupSizes = new int[] { 3 };
integerTextBox1.IntegerValue = 1234567;integerTextBox1.NumberGroupSeparator = ",";
integerTextBox1.NumberGroupSizes = new int[] { 3 };
integerTextBox1.IntegerValue = 1234567;integerTextBox1.BindableValueChanged +=
(sender, e) => MessageBox.Show($"New value: {integerTextBox1.IntegerValue}");integerTextBox1.BindableValueChanged +=
(sender, e) => MessageBox.Show($"New value: {integerTextBox1.IntegerValue}");integerTextBox1.ValidationError += (sender, e) =>
{
MessageBox.Show("Invalid input! Please enter a valid integer.");
};integerTextBox1.ValidationError += (sender, e) =>
{
MessageBox.Show("Invalid input! Please enter a valid integer.");
};| Property | Purpose | Example |
|---|---|---|
| MaxValue | Upper bound for integer values | |
| MinValue | Lower bound for integer values | |
| IntegerValue | Get/set the current integer value | |
| BindableValue | Wrapper for null-safe value access | |
| AllowLeadingZeros | Allow zeros before number (e.g., "0123") | |
| NumberGroupSeparator | Character to separate digit groups | |
| NumberGroupSizes | Size of each digit group | |
| PositiveColor | Color for positive values | |
| NegativeColor | Color for negative values | |
| ZeroColor | Color when value is zero | |
| BackColor | Control background color | |
| ReadOnlyBackColor | Background when read-only | |
| ReadOnly | Prevent user editing | |
| DeleteSelectionOnNegative | Delete selected text when minus pressed | |
| 属性 | 用途 | 示例 |
|---|---|---|
| MaxValue | 整数值的上限 | |
| MinValue | 整数值的下限 | |
| IntegerValue | 获取/设置当前整数值 | |
| BindableValue | 用于空值安全访问的包装器 | |
| AllowLeadingZeros | 允许数字前加零(例如“0123”) | |
| NumberGroupSeparator | 用于分隔数字组的字符 | |
| NumberGroupSizes | 每个数字组的大小 | |
| PositiveColor | 正值的颜色 | |
| NegativeColor | 负值的颜色 | |
| ZeroColor | 值为零时的颜色 | |
| BackColor | 控件背景颜色 | |
| ReadOnlyBackColor | 只读状态下的背景色 | |
| ReadOnly | 阻止用户编辑 | |
| DeleteSelectionOnNegative | 按下减号时删除选中的文本 | |
integerTextBox1.MinValue = 0;
integerTextBox1.MaxValue = 999999;
integerTextBox1.NumberGroupSeparator = ",";
integerTextBox1.NumberGroupSizes = new int[] { 3 };integerTextBox1.MinValue = -50;
integerTextBox1.MaxValue = 50;
integerTextBox1.NegativeColor = Color.Blue;
integerTextBox1.PositiveColor = Color.Red;integerTextBox1.IntegerValue = 42;
integerTextBox1.ReadOnly = true;
integerTextBox1.ReadOnlyBackColor = Color.LightGray;integerTextBox1.BindableValueChanged += (sender, e) =>
{
if (integerTextBox1.BindableValue == null)
MessageBox.Show("Value cleared (null)");
else
MessageBox.Show($"Value: {integerTextBox1.IntegerValue}");
};integerTextBox1.MinValue = 0;
integerTextBox1.MaxValue = 999999;
integerTextBox1.NumberGroupSeparator = ",";
integerTextBox1.NumberGroupSizes = new int[] { 3 };integerTextBox1.MinValue = -50;
integerTextBox1.MaxValue = 50;
integerTextBox1.NegativeColor = Color.Blue;
integerTextBox1.PositiveColor = Color.Red;integerTextBox1.IntegerValue = 42;
integerTextBox1.ReadOnly = true;
integerTextBox1.ReadOnlyBackColor = Color.LightGray;integerTextBox1.BindableValueChanged += (sender, e) =>
{
if (integerTextBox1.BindableValue == null)
MessageBox.Show("Value cleared (null)");
else
MessageBox.Show($"Value: {integerTextBox1.IntegerValue}");
};