ButtonBase.FlatStyle プロパティ

定義

ボタン コントロールのフラット スタイルの外観を取得または設定します。

public:
 property System::Windows::Forms::FlatStyle FlatStyle { System::Windows::Forms::FlatStyle get(); void set(System::Windows::Forms::FlatStyle value); };
public System.Windows.Forms.FlatStyle FlatStyle { get; set; }
member this.FlatStyle : System.Windows.Forms.FlatStyle with get, set
Public Property FlatStyle As FlatStyle

プロパティ値

FlatStyle

FlatStyle 値のいずれか 1 つ。 既定値は Standard です。

例外

代入された値が、FlatStyle 値ではありません。

次のコード例では、派生クラスを使用し、 Button その共通プロパティの一部を設定します。 結果は、左側にテキストが表示され、右側に画像が表示されたフラット ボタンになります。 このコードでは、ディレクトリに格納されているC:\Graphics名前MyBitMap.bmpのビットマップ イメージがあり、名前空間へのSystem.Drawing参照が含まれている必要があります。

private:
   void SetMyButtonProperties()
   {
      // Assign an image to the button.
      button1->Image = Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" );
      // Align the image and text on the button.
      button1->ImageAlign = ContentAlignment::MiddleRight;
      button1->TextAlign = ContentAlignment::MiddleLeft;
      // Give the button a flat appearance.
      button1->FlatStyle = FlatStyle::Flat;
   }
private void SetMyButtonProperties()
 {
    // Assign an image to the button.
    button1.Image = Image.FromFile("C:\\Graphics\\MyBitmap.bmp");
    // Align the image and text on the button.
    button1.ImageAlign = ContentAlignment.MiddleRight;    
    button1.TextAlign = ContentAlignment.MiddleLeft;
    // Give the button a flat appearance.
    button1.FlatStyle = FlatStyle.Flat;
 }
Private Sub SetMyButtonProperties()
    ' Assign an image to the button.
    button1.Image = Image.FromFile("C:\Graphics\MyBitmap.bmp")
    ' Align the image and text on the button.
    button1.ImageAlign = ContentAlignment.MiddleRight
    button1.TextAlign = ContentAlignment.MiddleLeft
    ' Give the button a flat appearance.
    button1.FlatStyle = FlatStyle.Flat
End Sub

注釈

クラスのプロパティがFlatStyle設定Systemされている場合、コントロールはユーザーのオペレーティング システムによって描画され、チェックの配置は、およびTextAlignプロパティの値にCheckAlign基づいています。RadioButton CheckBox プロパティ値は CheckAlign 変更されませんが、コントロールの外観が影響を受ける可能性があります。 チェック ボックスは、コントロールの左端または右端に水平方向に配置され (左揃えまたは中央揃え、右揃えのまま)、説明テキストと同じように垂直方向に配置されます。 たとえば、CheckBoxCheckAlignプロパティ値ContentAlignmentが . MiddleCenterTextAlign、プロパティ値 、ContentAlignment.TopRightおよびFlatStyleプロパティ値が設定Systemされている場合、テキストの配置が変更されていない間は、チェック ボックスの配置が表示されますContentAlignment.TopLeft

注意

プロパティがFlatStyle設定されている場合、プロパティにFlatStyle.SystemImage割り当てられているイメージは表示されません。

適用対象

こちらもご覧ください