英語で読む

次の方法で共有


GroupBox.FlatStyle プロパティ

定義

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

C#
public System.Windows.Forms.FlatStyle FlatStyle { get; set; }

プロパティ値

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

例外

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

次のコード例では、 コントロールと 2 つのRadioButtonコントロールをGroupBoxインスタンス化して作成します。 オプション ボタン (ラジオ ボタンとも呼ばれます) がグループ ボックスに追加され、グループ ボックスが に Form追加されます。

C#
private void InitializeMyGroupBox()
{
    // Create and initialize a GroupBox and a Button control.
    GroupBox groupBox1 = new GroupBox();
    Button button1 = new Button();
    button1.Location = new Point(20,10);

    // Set the FlatStyle of the GroupBox.
    groupBox1.FlatStyle = FlatStyle.Flat;

    // Add the Button to the GroupBox.
    groupBox1.Controls.Add(button1);

    // Add the GroupBox to the Form.
    Controls.Add(groupBox1);

    // Create and initialize a GroupBox and a Button control.
    GroupBox groupBox2 = new GroupBox();
    Button button2 = new Button();
    button2.Location = new Point(20, 10);
    groupBox2.Location = new Point(0, 120);

    // Set the FlatStyle of the GroupBox.
    groupBox2.FlatStyle = FlatStyle.Standard;

    // Add the Button to the GroupBox.
    groupBox2.Controls.Add(button2);

    // Add the GroupBox to the Form.
    Controls.Add(groupBox2);
}

注釈

GroupBoxの値Systemを持FlatStyleつ は、マウス イベントを受け取りません。

適用対象

製品 バージョン
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

こちらもご覧ください