System.Windows.Forms.Control.SetStyle Method

Sets a specified System.Windows.Forms.ControlStyles flag to either true or false.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
protected void SetStyle (ControlStyles flag, bool value)

Parameters

flag
The System.Windows.Forms.ControlStyles bit to set.
value
true to apply the specified style to the control; otherwise, false.

Remarks

Control style bit flags are used to categorize supported behavior. A control can enable a style by calling the Control.SetStyle(ControlStyles, bool) method and passing in the appropriate System.Windows.Forms.ControlStyles bit (or bits) and the Boolean value to set the bit(s) to. To determine the value assigned to a specified System.Windows.Forms.ControlStyles bit, use the Control.GetStyle(ControlStyles) method and pass in the System.Windows.Forms.ControlStyles member to evaluate.

Note:

Setting the control style bits can substantially change the behavior of the control. Review the System.Windows.Forms.ControlStyles enumeration documentation to understand the effects of changing the control style bits before calling the Control.SetStyle(ControlStyles, bool) method.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0