Loading...
Loading...
Compare original and translation side by side
PercentTextBoxPercentValueMaxValueMinValueBindablePercentValueChangedPercentTextBoxPercentValueMaxValueMinValueBindablePercentValueChangedusing Syncfusion.Windows.Forms.Tools;
// Create instance
PercentTextBox percentTextBox1 = new PercentTextBox();
this.Controls.Add(percentTextBox1);
// Set value
percentTextBox1.PercentValue = 50;
// Set constraints
percentTextBox1.MaxValue = 100;
percentTextBox1.MinValue = 0;
// Subscribe to value changed event
percentTextBox1.BindablePercentValueChanged += (sender, e) =>
{
Console.WriteLine($"Percent: {percentTextBox1.PercentValue}%");
};using Syncfusion.Windows.Forms.Tools;
// Create instance
PercentTextBox percentTextBox1 = new PercentTextBox();
this.Controls.Add(percentTextBox1);
// Set value
percentTextBox1.PercentValue = 50;
// Set constraints
percentTextBox1.MaxValue = 100;
percentTextBox1.MinValue = 0;
// Subscribe to value changed event
percentTextBox1.BindablePercentValueChanged += (sender, e) =>
{
Console.WriteLine($"Percent: {percentTextBox1.PercentValue}%");
};var percentBox = new PercentTextBox();
percentBox.PercentValue = 25;
percentBox.MinValue = 0;
percentBox.MaxValue = 100;
percentBox.PercentDecimalDigits = 2;var percentBox = new PercentTextBox();
percentBox.PercentValue = 25;
percentBox.MinValue = 0;
percentBox.MaxValue = 100;
percentBox.PercentDecimalDigits = 2;percentTextBox1.DataBindings.Add("BindablePercentValue", dataSource, "PercentageField");percentTextBox1.DataBindings.Add("BindablePercentValue", dataSource, "PercentageField");percentTextBox1.ValidationError += (sender, e) =>
{
MessageBox.Show($"Invalid input: {e.ErrorMessage}");
};percentTextBox1.ValidationError += (sender, e) =>
{
MessageBox.Show($"Invalid input: {e.ErrorMessage}");
};percentTextBox1.PercentDecimalDigits = 3;
percentTextBox1.PercentDecimalSeparator = ".";
percentTextBox1.PercentGroupSeparator = ",";
percentTextBox1.PercentGroupSizes = new int[] { 2 };percentTextBox1.PercentDecimalDigits = 3;
percentTextBox1.PercentDecimalSeparator = ".";
percentTextBox1.PercentGroupSeparator = ",";
percentTextBox1.PercentGroupSizes = new int[] { 2 };| Property | Type | Purpose |
|---|---|---|
| double | Gets/sets the percentage value (0-100) |
| double | Gets/sets the decimal value (0-1) |
| double? | Nullable percent value for data binding |
| double? | Nullable decimal value for data binding |
| double | Maximum allowed value |
| double | Minimum allowed value |
| double | Default value when reset |
| bool | Allows null/empty input |
| string | Display text when null |
| int | Number of decimal places |
| string | Decimal separator character |
| string | Thousands separator |
| int[] | Group size for thousands |
| bool | Allow negative on select-all |
| 属性 | 类型 | 用途 |
|---|---|---|
| double | 获取/设置百分比值(0-100) |
| double | 获取/设置小数值(0-1) |
| double? | 用于数据绑定的可空百分比值 |
| double? | 用于数据绑定的可空小数值 |
| double | 允许的最大值 |
| double | 允许的最小值 |
| double | 重置时的默认值 |
| bool | 允许空/空白输入 |
| string | 值为空时的展示文本 |
| int | 小数位数 |
| string | 小数分隔符 |
| string | 千位分隔符 |
| int[] | 千位分组大小 |
| bool | 全选时允许输入负值 |