• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.ConvertEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.CreateParams类代码示例发布时间:2022-05-26
下一篇:
C# Forms.ControlEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap