Control.SetStyle(ControlStyles, Boolean) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した ControlStyles フラグを true または falseに設定します。
protected:
void SetStyle(System::Windows::Forms::ControlStyles flag, bool value);
protected void SetStyle(System.Windows.Forms.ControlStyles flag, bool value);
member this.SetStyle : System.Windows.Forms.ControlStyles * bool -> unit
Protected Sub SetStyle (flag As ControlStyles, value As Boolean)
パラメーター
- flag
- ControlStyles
設定する ControlStyles ビット。
- value
- Boolean
true 指定したスタイルをコントロールに適用する場合。それ以外の場合は false。
例
次のコード例では、 Form でダブル バッファリングを有効にし、変更を反映するようにスタイルを更新します。
public:
void EnableDoubleBuffering()
{
// Set the value of the double-buffering style bits to true.
this->SetStyle( static_cast<ControlStyles>(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint), true );
this->UpdateStyles();
}
public void EnableDoubleBuffering()
{
// Set the value of the double-buffering style bits to true.
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}
Public Sub EnableDoubleBuffering()
' Set the value of the double-buffering style bits to true.
Me.SetStyle(ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint, _
True)
Me.UpdateStyles()
End Sub
注釈
コントロール スタイルのビット フラグは、サポートされている動作を分類するために使用されます。 コントロールは、 SetStyle メソッドを呼び出し、適切な ControlStyles ビット (またはビット) とブール値を渡してビットを設定することで、スタイルを有効にすることができます。 指定した ControlStyles ビットに割り当てられた値を確認するには、 GetStyle メソッドを使用し、評価する ControlStyles メンバーを渡します。
Caution
コントロール スタイル ビットを設定すると、コントロールの動作が大幅に変わる可能性があります。 SetStyle メソッドを呼び出す前に、ControlStyles列挙のドキュメントを参照して、コントロール スタイル ビットの変更の効果を理解します。