public static void LimpiarForm(Control Objeto) { foreach (Control Item in Objeto.Controls) { if (Item is Control) { Control ObjConatiner = (Control)Item; foreach (Control editable in ObjConatiner.Controls) { if (editable is TextBoxBase) { TextBoxBase objText = (TextBoxBase)editable; objText.Clear(); } if (editable is ListControl) { ListControl objListControl = (ListControl)editable; objListControl.SelectedIndex = 0; } if (editable is ButtonBase) { ButtonBase buttonBase = (ButtonBase)editable; buttonBase.Refresh(); } } //End foreach editable } } //End foreach of object } //End Method LimpiarForm
/// <summary> /// Sets the text image relation. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetTextImageRelation(this ButtonBase control, TextImageRelation value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetTextImageRelation(value))); } else { control.TextImageRelation = value; control.Refresh(); } }
/// <summary> /// Sets the use compatible text rendering. /// </summary> /// <param name="control">The control.</param> /// <param name="value">if set to <c>true</c> [value].</param> public static void SetUseCompatibleTextRendering(this ButtonBase control, bool value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetUseCompatibleTextRendering(value))); } else { control.UseCompatibleTextRendering = value; control.Refresh(); } }
/// <summary> /// Sets the text. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetText(this ButtonBase control, string value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetText(value))); } else { control.Text = value; control.Refresh(); } }
/// <summary> /// Sets the text align. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetTextAlign(this ButtonBase control, ContentAlignment value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetTextAlign(value))); } else { control.TextAlign = value; control.Refresh(); } }
/// <summary> /// Sets the automatic ellipsis. /// </summary> /// <param name="control">The control.</param> /// <param name="value">if set to <c>true</c> [value].</param> public static void SetAutoEllipsis(this ButtonBase control, bool value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetAutoEllipsis(value))); } else { control.AutoEllipsis = value; control.Refresh(); } }
/// <summary> /// Sets the color of the back. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetBackColor(this ButtonBase control, Color value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetBackColor(value))); } else { control.BackColor = value; control.Refresh(); } }
/// <summary> /// Sets the image list. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetImageList(this ButtonBase control, ImageList value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetImageList(value))); } else { control.ImageList = value; control.Refresh(); } }
/// <summary> /// Sets the flat style. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetFlatStyle(this ButtonBase control, FlatStyle value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetFlatStyle(value))); } else { control.FlatStyle = value; control.Refresh(); } }
/// <summary> /// Sets the use mnemonic. /// </summary> /// <param name="control">The control.</param> /// <param name="value">if set to <c>true</c> [value].</param> public static void SetUseMnemonic(this ButtonBase control, bool value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetUseMnemonic(value))); } else { control.UseMnemonic = value; control.Refresh(); } }