本文整理汇总了C#中System.Windows.Forms.ConvertEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ConvertEventArgs类的具体用法?C# ConvertEventArgs怎么用?C# ConvertEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConvertEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了ConvertEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnKeyModifierBindingConvert
private static void OnKeyModifierBindingConvert(object sender, ConvertEventArgs e)
{
if (e.Value is XKeys && e.DesiredType == typeof (ModifierFlags))
{
ModifierFlags result = ModifierFlags.None;
XKeys value = (XKeys) e.Value;
if ((value & XKeys.Control) == XKeys.Control)
result = result | ModifierFlags.Control;
if ((value & XKeys.Alt) == XKeys.Alt)
result = result | ModifierFlags.Alt;
if ((value & XKeys.Shift) == XKeys.Shift)
result = result | ModifierFlags.Shift;
e.Value = result;
}
else if (e.Value is ModifierFlags && e.DesiredType == typeof (XKeys))
{
XKeys result = XKeys.None;
ModifierFlags value = (ModifierFlags) e.Value;
if ((value & ModifierFlags.Control) == ModifierFlags.Control)
result = result | XKeys.Control;
if ((value & ModifierFlags.Alt) == ModifierFlags.Alt)
result = result | XKeys.Alt;
if ((value & ModifierFlags.Shift) == ModifierFlags.Shift)
result = result | XKeys.Shift;
e.Value = result;
}
}
开发者ID:nhannd,项目名称:Xian,代码行数:27,代码来源:MouseImageViewerToolPropertyComponentControl.cs
示例2: Invert
private static void Invert(object sender, ConvertEventArgs e)
{
if (e.DesiredType == typeof(bool))
{
e.Value = !((bool)e.Value);
}
}
开发者ID:AleksMorozova,项目名称:prizm,代码行数:7,代码来源:BindingHelper.cs
示例3: OnFormatQuality
private void OnFormatQuality(object sender, ConvertEventArgs e)
{
if (e.DesiredType != typeof(string))
return;
e.Value = String.Format("({0})", (int)e.Value);
}
开发者ID:nhannd,项目名称:Xian,代码行数:7,代码来源:AviExportAdvancedComponentControl.cs
示例4: ImageToFile
private void ImageToFile(object sender, ConvertEventArgs e)
{
if (e.DesiredType == typeof(string))
{
// Substitute the filename.
e.Value = picProduct.Tag;
}
}
开发者ID:ehershey,项目名称:development,代码行数:8,代码来源:BindToImage.cs
示例5: DecimalToFloatString
public static void DecimalToFloatString(object sender, ConvertEventArgs cevent)
{
// The method converts only to string type. Test this using the DesiredType.
if (cevent.DesiredType != typeof(string)) return;
if(!string.IsNullOrEmpty(cevent.Value.ToString()))
cevent.Value = ((decimal)cevent.Value).ToString("###,###,###.00");
}
开发者ID:okyereadugyamfi,项目名称:okerospos,代码行数:8,代码来源:Formatter.cs
示例6: DecimalToCurrencyString
private void DecimalToCurrencyString(object sender, ConvertEventArgs e)
{
if (e.DesiredType == typeof(string))
{
// Use the ToString method to format the value as currency ("c").
e.Value = ((decimal)e.Value).ToString("c");
}
}
开发者ID:ehershey,项目名称:development,代码行数:8,代码来源:EditableBinding.cs
示例7: CheckBoxNeverEnd_Format
void CheckBoxNeverEnd_Format(object sender, ConvertEventArgs e)
{
// from object to control
// Never Ending should be checked when there is no end date
if (e.DesiredType == typeof(bool))
e.Value = (e.Value == null);
}
开发者ID:abdojobs,项目名称:dotnet-scheduling,代码行数:8,代码来源:ScheduleView.cs
示例8: DecimalToCurrencyString
public static void DecimalToCurrencyString(object sender, ConvertEventArgs cevent)
{
// The method converts only to string type. Test this using the DesiredType.
if (cevent.DesiredType != typeof(string)) return;
// Use the ToString method to format the value as currency ("c").
if (!string.IsNullOrEmpty(cevent.Value.ToString()))
cevent.Value = ((decimal)cevent.Value).ToString("c");
}
开发者ID:okyereadugyamfi,项目名称:okerospos,代码行数:9,代码来源:Formatter.cs
示例9: DateFormat
public static void DateFormat(object sender, ConvertEventArgs e)
{
if (e.Value is System.DBNull)
{
return;
}
e.Value = Convert.ToDateTime(e.Value).ToShortDateString();
}
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:9,代码来源:DataFormatting.cs
示例10: CurrencyFormat
public static void CurrencyFormat(object sender, ConvertEventArgs e)
{
if (e.Value is System.DBNull)
{
return;
}
e.Value = (Convert.ToDouble(e.Value)).ToString("C");
}
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:9,代码来源:DataFormatting.cs
示例11: FloatStringToDecimal
public static void FloatStringToDecimal(object sender, ConvertEventArgs cevent)
{
// The method converts back to decimal type only.
if (cevent.DesiredType != typeof(decimal)) return;
// Converts the string back to decimal using the static Parse method.
cevent.Value = Decimal.Parse(cevent.Value.ToString(),
NumberStyles.Any, null);
}
开发者ID:okyereadugyamfi,项目名称:okerospos,代码行数:9,代码来源:Formatter.cs
示例12: CurrencyStringToDecimal
public static void CurrencyStringToDecimal(object sender, ConvertEventArgs cevent)
{
// The method converts back to decimal type only.
if (cevent.DesiredType != typeof(decimal)) return;
if (!string.IsNullOrEmpty(cevent.Value.ToString()))
// Converts the string back to decimal using the static Parse method.
cevent.Value = Decimal.Parse(cevent.Value.ToString(),
NumberStyles.Currency, null);
}
开发者ID:okyereadugyamfi,项目名称:okerospos,代码行数:9,代码来源:Formatter.cs
示例13: OnFormat
protected override void OnFormat(ConvertEventArgs cevent)
{
if (this._converter != null)
{
var converterdValue = this._converter.Convert(cevent.Value, cevent.DesiredType, _converterParameter,
_converterCulture);
cevent.Value = converterdValue;
}
else base.OnFormat(cevent);
}
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:10,代码来源:CustomBinding.cs
示例14: OnPortBindingFormat
void OnPortBindingFormat(object sender, ConvertEventArgs e)
{
if (e.DesiredType != typeof(string))
return;
if ((int)e.Value <= 0)
e.Value = "";
else
e.Value = e.Value.ToString();
}
开发者ID:nhannd,项目名称:Xian,代码行数:10,代码来源:DicomServerConfigurationComponentControl.cs
示例15: IsShredHostRunningFormat
void IsShredHostRunningFormat(object sender, ConvertEventArgs e)
{
// The method converts only to string type. Test this using the DesiredType.
if (e.DesiredType != typeof(string)) return;
// Use the ToString method to format the value as currency ("c").
if (true == ((bool)e.Value))
e.Value = (string)"ShredHost is Running";
else
e.Value = (string)"ShredHost is Stopped";
}
开发者ID:nhannd,项目名称:Xian,代码行数:11,代码来源:ShredHostClientComponentControl.cs
示例16: PercentFormat
public static void PercentFormat(object sender, ConvertEventArgs e)
{
if (e.Value is System.DBNull)
{
return;
}
double percentValue = Convert.ToDouble(e.Value);
percentValue = percentValue / 100;
e.Value = percentValue.ToString("P0");
}
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:11,代码来源:DataFormatting.cs
示例17: CheckBoxNeverEnd_Parse
void CheckBoxNeverEnd_Parse(object sender, ConvertEventArgs e)
{
// from control to object
if (e.DesiredType == typeof(DateTime?) && e.Value is bool)
{
//e.Value = ((bool)e.Value == true ? (DateTime?)null : DateTime.Today);
if ((bool)e.Value == true)
e.Value = null;
//else
// e.Value = ((Schedule)((BindingSource)((Binding)sender).DataSource).Current).EndDate;
}
}
开发者ID:abdojobs,项目名称:dotnet-scheduling,代码行数:12,代码来源:ScheduleView.cs
示例18: EndDate_Format
void EndDate_Format(object sender, ConvertEventArgs e)
{
// from object to control
DateTime? val = e.Value as DateTime?;
// if desired type is DateTime then we're binding Value
// if desired type is Boolean then we're binding Enabled
if (e.DesiredType == typeof(DateTime))
e.Value = (val.HasValue ? e.Value : dtpEndDate.Value);
else if (e.DesiredType == typeof(bool))
e.Value = val.HasValue;
}
开发者ID:abdojobs,项目名称:dotnet-scheduling,代码行数:12,代码来源:ScheduleView.cs
示例19: OnRadioBindingParse
void OnRadioBindingParse(object sender, ConvertEventArgs e)
{
if (e.DesiredType != typeof(DateFormatApplicationComponent.DateFormatOptions))
return;
if (_radioCustom.Checked)
e.Value = DateFormatApplicationComponent.DateFormatOptions.Custom;
else if (_radioSystemLongDate.Checked)
e.Value = DateFormatApplicationComponent.DateFormatOptions.SystemLong;
else
e.Value = DateFormatApplicationComponent.DateFormatOptions.SystemShort;
}
开发者ID:nhannd,项目名称:Xian,代码行数:12,代码来源:DateFormatApplicationComponentControl.cs
示例20: OnFormat
void OnFormat(object sender, ConvertEventArgs e)
{
if (_keyProperty > 0)
{
_errorProvider.SetError(_comboBox, "");
return;
}
if (string.IsNullOrEmpty(_comboBox.Text))
{
e.Value = "";
_errorProvider.SetError(_comboBox, string.Format("{0} required.", _friendlyName));
}
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:14,代码来源:ComboValidation.cs
注:本文中的System.Windows.Forms.ConvertEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论