当前位置: 首页>>代码示例>>C#>>正文


C# System.Windows.Forms.GetType方法代码示例

本文整理汇总了C#中System.Windows.Forms.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.GetType方法的具体用法?C# System.Windows.Forms.GetType怎么用?C# System.Windows.Forms.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms的用法示例。


在下文中一共展示了System.Windows.Forms.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetTo

 public void SetTo(Win.Control ct, object value, bool isControlEnabled)
 {
     string propName = ct.Name.Substring(3);
     if (value == null)
     {
         value = _Row[propName].Value;
     }
     switch (ct.GetType().Name)
     {
         case "TextBox":
             ((Win.TextBox)ct).Text = Convert.ToString(value);
             ((Win.TextBox)ct).Enabled = isControlEnabled;
             break;
         case "ComboBox":
             ((Win.ComboBox)ct).Items.Add(value);
             break;
         case "Label":
             ((Win.Label)ct).Text = Convert.ToString(value);
             break;
         case "DateTimePicker":
             DateTime dt;
             if (DateTime.TryParse(Convert.ToString(value), out dt))
             {
                 ((Win.DateTimePicker)ct).Value = dt;
             }
             break;
         case "ListBox":
             ((Win.ListBox)ct).Items.Add(value);
             break;
         case "CheckBox":
             bool tempValue;
             if (Convert.ToString(value) == "1")
             {
                 tempValue = true;
             }
             else
             {
                 bool.TryParse(Convert.ToString(value), out tempValue);
             }
             ((Win.CheckBox)ct).Checked = tempValue;
             ((Win.CheckBox)ct).Enabled = isControlEnabled;
             break;
         case "NumericUpDown":
             decimal result = 0;
             if (decimal.TryParse(Convert.ToString(value), out result))
             {
                 ((Win.NumericUpDown)ct).Value = result;
             }
             break;
         case "RichTextBox":
             ((Win.ListBox)ct).Text = Convert.ToString(value);
             break;
     }
 }
开发者ID:Angliy,项目名称:Common,代码行数:54,代码来源:MActionUI.cs

示例2: ShowHelpInControl

		private void ShowHelpInControl (SWF.Control ctrl) 
		{		
			MethodInfo methodInfo = ctrl.GetType ().GetMethod ("WndProc",
			                                                   BindingFlags.InvokeMethod
			                                                   | BindingFlags.NonPublic
			                                                   | BindingFlags.Instance);
			HELPINFO info = new HELPINFO ();

			SD.Rectangle rectangle = ctrl.TopLevelControl.RectangleToScreen (ctrl.Bounds);
			
			info.MousePos = new POINT (rectangle.X + 5, 
			                           rectangle.Y + 5);
			
			IntPtr ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (HELPINFO)));
			Marshal.StructureToPtr (info, ptr, false);
			
			SWF.Message message = SWF.Message.Create (ctrl.Handle,
			                                          (int) Msg.WM_HELP, 
			                                          IntPtr.Zero, 
			                                          ptr);
			
			methodInfo.Invoke (ctrl, new object[] { message });
		}
开发者ID:mono,项目名称:uia2atk,代码行数:23,代码来源:HelpProviderTest.cs

示例3: GetFrom

 public void GetFrom(Win.Control ct, object value)
 {
     string propName = ct.Name.Substring(3);
     if (value == null)
     {
         switch (ct.GetType().Name)
         {
             case "TextBox":
                 value = ((Win.TextBox)ct).Text.Trim();
                 break;
             case "ComboBox":
                 value = ((Win.ComboBox)ct).Text;
                 break;
             case "Label":
                 value = ((Win.Label)ct).Text;
                 break;
             case "DateTimePicker":
                 value = ((Win.DateTimePicker)ct).Value;
                 break;
             case "ListBox":
                 value = ((Win.ListBox)ct).Text;
                 break;
             case "CheckBox":
                 value = ((Win.CheckBox)ct).Checked;
                 break;
             case "NumericUpDown":
                 value = ((Win.NumericUpDown)ct).Value;
                 break;
             case "RichTextBox":
                 value = ((Win.RichTextBox)ct).Text;
                 break;
         }
     }
     _Row[propName].Value = value;
 }
开发者ID:Angliy,项目名称:Common,代码行数:35,代码来源:MActionUI.cs


注:本文中的System.Windows.Forms.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。