當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.ConvertEventArgs類代碼示例

本文整理匯總了C#中System.Windows.Forms.ConvertEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# ConvertEventArgs類的具體用法?C# ConvertEventArgs怎麽用?C# ConvertEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConvertEventArgs類屬於System.Windows.Forms命名空間,在下文中一共展示了ConvertEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的System.Windows.Forms.ConvertEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。