/// <summary> /// Increments targeted ProgressBar. /// </summary> /// <param name="amount">Optional. Amount to increment bar by. Defaults to 1.</param> public void IncrementBar(int amount = 1) { if (Strip.InvokeRequired) { Strip.BeginInvoke(new Action(() => Progbar.Increment(amount))); } else { Progbar.Increment(amount); } }
/// <summary> /// Updates text of targeted text property. /// </summary> /// <param name="text">New text to display.</param> public void UpdateText(string text) { // KFreon: Check which control to update if (control == null) { if (strip.InvokeRequired) { strip.BeginInvoke(new Action(() => UpdateText(text))); } else { item.Text = text; } } else { if (control.InvokeRequired) { control.BeginInvoke(new Action(() => control.Text = text)); } else { control.Text = text; } } }
public void InvokeIfRequired(MethodInvoker _delegate) { if (ToolStrip.InvokeRequired) { ToolStrip.BeginInvoke(_delegate); } else { _delegate(); } }
/// <summary> /// Thread-safe /// </summary> public static void ClearAllSelections(this ToolStrip toolstrip) { if (toolstrip.InvokeRequired) { toolstrip.BeginInvoke(new Action(() => ClearAllSelections(toolstrip))); } else { ClearAllSelectionsMethod.Invoke(toolstrip, null); } }
/// <summary> /// Sets the causes validation. /// </summary> /// <param name="control">The control.</param> /// <param name="value">if set to <c>true</c> [value].</param> public static void SetCausesValidation(this ToolStrip control, bool value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetCausesValidation(value))); } else { control.CausesValidation = value; control.Refresh(); } }
/// <summary> /// Sets the layout style. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetLayoutStyle(this ToolStrip control, ToolStripLayoutStyle value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetLayoutStyle(value))); } else { control.LayoutStyle = value; control.Refresh(); } }
/// <summary> /// Sets the dock. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetDock(this ToolStrip control, DockStyle value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetDock(value))); } else { control.Dock = value; control.Refresh(); } }
private void EnableToolStripControl(ToolStrip toolstrip, ToolStripComboBox cb, bool enable) { if (toolstrip.InvokeRequired) { EnableToolStripControlCallback d = new EnableToolStripControlCallback(EnableToolStripControl); toolstrip.BeginInvoke(d, new object[] { toolstrip, cb, enable }); } else { cb.Enabled = enable; } }
/// <summary> /// Sets the anchor. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetAnchor(this ToolStrip control, AnchorStyles value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetAnchor(value))); } else { control.Anchor = value; control.Refresh(); } }
/// <summary> /// Sets the automatic scroll. /// </summary> /// <param name="control">The control.</param> /// <param name="value">if set to <c>true</c> [value].</param> public static void SetAutoScroll(this ToolStrip control, bool value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetAutoScroll(value))); } else { control.AutoScroll = value; control.Refresh(); } }
/// <summary> /// Sets the show item tool tips. /// </summary> /// <param name="control">The control.</param> /// <param name="value">if set to <c>true</c> [value].</param> public static void SetShowItemToolTips(this ToolStrip control, bool value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetShowItemToolTips(value))); } else { control.ShowItemToolTips = value; control.Refresh(); } }
/// <summary> /// Sets the text direction. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetTextDirection(this ToolStrip control, ToolStripTextDirection value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetTextDirection(value))); } else { control.TextDirection = value; control.Refresh(); } }
/// <summary> /// Sets the binding context. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetBindingContext(this ToolStrip control, BindingContext value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetBindingContext(value))); } else { control.BindingContext = value; control.Refresh(); } }
/// <summary> /// Sets the render mode. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetRenderMode(this ToolStrip control, ToolStripRenderMode value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetRenderMode(value))); } else { control.RenderMode = value; control.Refresh(); } }
/// <summary> /// Sets the size of the image scaling. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetImageScalingSize(this ToolStrip control, Size value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetImageScalingSize(value))); } else { control.ImageScalingSize = 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 ToolStrip control, ImageList value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetImageList(value))); } else { control.ImageList = value; control.Refresh(); } }
/// <summary> /// Sets the grip margin. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetGripMargin(this ToolStrip control, Padding value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetGripMargin(value))); } else { control.GripMargin = value; control.Refresh(); } }
/// <summary> /// Sets the allow item reorder. /// </summary> /// <param name="control">The control.</param> /// <param name="value">if set to <c>true</c> [value].</param> public static void SetAllowItemReorder(this ToolStrip control, bool value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetAllowItemReorder(value))); } else { control.AllowItemReorder = value; control.Refresh(); } }
/// <summary> /// Sets the color of the fore. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetForeColor(this ToolStrip control, Color value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetForeColor(value))); } else { control.ForeColor = value; control.Refresh(); } }