Control.GetStyle メソッド
コントロールの指定したコントロール スタイル ビットの値を取得します。
Protected Function GetStyle( _
ByVal flag As ControlStyles _) As Boolean
[C#]
protected bool GetStyle(ControlStylesflag);
[C++]
protected: bool GetStyle(ControlStylesflag);
[JScript]
protected function GetStyle(
flag : ControlStyles) : Boolean;
パラメータ
- flag
値を返す ControlStyles ビット。
戻り値
指定したコントロール スタイル ビットが true に設定されている場合は true 。それ以外の場合は false 。
解説
コントロール スタイル ビット フラグは、サポートされている動作を分類するために使用します。コントロールは SetStyle メソッドを呼び出して、適切な ControlStyles ビットとビットを設定する Boolean 値を渡すことによって、スタイルを有効にすることができます。指定した ControlStyles ビットに割り当てられている値を確認するには、 GetStyle メソッドを使用して、評価する ControlStyles メンバを渡します。
使用例
[Visual Basic, C#, C++] ダブル バッファリング処理されている Form のスタイル ビットの値を返す例を次に示します。この例では、すべてのスタイル ビットが true に設定されている場合にだけ true を返します。
Public Function DoubleBufferingEnabled() As Boolean
' Get the value of the double-buffering style bits.
Return Me.GetStyle((ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint))
End Function
[C#]
public bool DoubleBufferingEnabled()
{
// Get the value of the double-buffering style bits.
return this.GetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint);
}
[C++]
public:
bool DoubleBufferingEnabled() {
// Get the value of the double-buffering style bits.
return this->GetStyle(static_cast<ControlStyles>(ControlStyles::DoubleBuffer |
ControlStyles::UserPaint |
ControlStyles::AllPaintingInWmPaint));
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
Control クラス | Control メンバ | System.Windows.Forms 名前空間 | SetStyle | ControlStyles