Exemple #1
0
 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;
     }
 }
Exemple #2
0
		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 });
		}
Exemple #3
0
 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;
 }