/// <summary> /// Invoke方式设置DateTimePicker控件的Value属性 /// </summary> public static void InvokeDateTimePickerValue(DateTimePicker dtp, DateTime dateTime) { if (dtp.InvokeRequired) { dtp.Invoke(new MethodInvoker(delegate() { InvokeDateTimePickerValue(dtp, dateTime); })); } else { dtp.Value = dateTime; } }
public static DateTime readDateValue(this DateTimePicker varControl) { if (varControl.InvokeRequired) { return((DateTime)varControl.Invoke(new Func <DateTime>(() => readDateValue(varControl)))); } else { return(varControl.Value); } }
private DateTime GetDateTimePickerValue(DateTimePicker picker) { if (picker.InvokeRequired) { picker.Invoke(new GetDateTimePickerValueDelegate(GetDateTimePickerValue), new object[] { picker.Value }); } else { return(picker.Value); } return(picker.Value); }
public bool getDateTimePickerChecked(DateTimePicker control) { #region Variable var result = false; #endregion if (control.InvokeRequired) { control.Invoke(new MethodInvoker(delegate { result = control.Checked; })); } else { result = control.Checked; } return result; }
public DateTime? getDateTimePickerValue(DateTimePicker control) { #region Variable DateTime? result = null; #endregion if (control.InvokeRequired) { control.Invoke(new MethodInvoker(delegate { if (control.Checked) { result = control.Value; } })); } else { if (control.Checked) { result = control.Value; } } return result; }