本文整理汇总了C#中Xceed.ResetMinValue方法的典型用法代码示例。如果您正苦于以下问题:C# Xceed.ResetMinValue方法的具体用法?C# Xceed.ResetMinValue怎么用?C# Xceed.ResetMinValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xceed
的用法示例。
在下文中一共展示了Xceed.ResetMinValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetNumericTextBoxFormat
/// <summary>
///
/// </summary>
/// <param name="textBox"></param>
/// <param name="textBoxType"></param>
/// <param name="format"></param>
private static void SetNumericTextBoxFormat(Xceed.Editors.WinNumericTextBox textBox, NumericTextBoxType textBoxType, string format)
{
if (textBox.EditFormatProvider == null)
{
textBox.EditFormatProvider = (System.Globalization.CultureInfo.CurrentCulture.NumberFormat).Clone() as System.Globalization.NumberFormatInfo;
}
if (textBox.DisplayFormatProvider == null)
{
textBox.DisplayFormatProvider = (System.Globalization.CultureInfo.CurrentCulture.NumberFormat).Clone() as System.Globalization.NumberFormatInfo;
}
switch (textBoxType)
{
case NumericTextBoxType.Integer:
textBox.DataType = typeof(int);
break;
case NumericTextBoxType.Long:
textBox.DataType = typeof(long);
break;
case NumericTextBoxType.Number:
textBox.DataType = typeof(double);
break;
case NumericTextBoxType.Currency:
textBox.DataType = typeof(decimal);
break;
}
if (!string.IsNullOrEmpty(format))
{
if (format.Length != 2)
{
throw new ArgumentException("format is invalid");
}
if (format[0] == '-')
{
textBox.ResetMinValue();
//textBox.NegativeSignInputChars = new char[] { '-' };
textBox.EditFormatProvider.NegativeSign = "-";
textBox.ResetNegativeSignInputChars(); // set accoring EditFormatProvider.NegativeSign
}
else
{
//// can't set empty array
//this.NegativeSignInputChars = new char[] { };
textBox.MinValue = 0;
textBox.EditFormatProvider.NegativeSign = "";
textBox.ResetNegativeSignInputChars();
}
switch (textBoxType)
{
case NumericTextBoxType.Integer:
textBox.Decimals = 0;
//can't set empty
textBox.EditFormatProvider.NumberDecimalSeparator = "`";
textBox.DecimalSeparatorInputChars = new char[] { };
//2λ�ַ�����һλΪ��+�����ߡ�-�����ڶ�λΪ���λ���� Ĭ��Ϊ"+8",��ֻ����������8λ����
break;
case NumericTextBoxType.Long:
textBox.Decimals = 0;
textBox.EditFormatProvider.NumberDecimalSeparator = "`";
textBox.DecimalSeparatorInputChars = new char[] { };
break;
case NumericTextBoxType.Number:
case NumericTextBoxType.Currency:
//>2λ�ַ�����һλΪ��+�����ߡ�-�����ڶ�λΪС����λ���� Ĭ��Ϊ"+2",��ֻ����������2λС��
int decimals = ConvertHelper.ToInt(format[1]).Value;
// ��λ������ʱ���ᵼ��Grid���ܱ��棬�ؼ��ﲻ���Ƴ�
//textBox.Decimals = decimals;
textBox.EditFormatProvider.NumberDecimalDigits = decimals;
textBox.EditFormatProvider.CurrencyDecimalDigits = decimals;
textBox.DisplayFormatSpecifier = "0.";
for (int i = 0; i < decimals; ++i)
{
textBox.DisplayFormatSpecifier += "0";
}
break;
}
}
}