PowerTools PlusPak for Windows Forms 8.0J
HeaderSettings プロパティ (GcGroupBoxControlBase)
使用例 

グループボックスヘッダに適用されるヘッダ設定を取得します。
構文
Public ReadOnly Property HeaderSettings As GroupHeaderSettings
public GroupHeaderSettings HeaderSettings {get;}

プロパティ値

ヘッダの特性を表すGroupHeaderSettings
解説

HeaderSettingsは、GroupHeaderSettings.BackColorGroupHeaderSettings.ForeColorGroupHeaderSettings.Font、またはGroupHeaderSettings.TextEffectをさまざまに組み合わせてヘッダを項目から区別する場合に使用できます。

また、GcGroupBoxControlBase.HeaderSettings.Alignmentプロパティを設定して、ヘッダの水平方向の配置をカスタマイズできます。GcGroupBoxControlBase.HeaderSettings.AutoEllipsisプロパティをtrueに設定すると、ヘッダのテキストが長すぎる場合にテキストの末尾が省略記号に置き換わります。

使用例

次のサンプルコードは、いくつかの項目を含むGcCheckedGroupBoxコントロールを作成する方法を示します。また、HeaderSettingsプロパティを使用してヘッダの外観をカスタマイズする方法も示します。このサンプルコードを実行するには、以下のコードをSystem.Windows.Forms.Formプロジェクトに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出します。

private void CreateMyGcCheckedGroupBoxWithHeaderSettings()
{
    GcCheckedGroupBox gcCheckedGroupBox = new GcCheckedGroupBox();

    // Set gcRadioGroupBox1's location.
    gcCheckedGroupBox.Location = new Point(10, 10);
    gcCheckedGroupBox.Text = "Center Header";

    // Create some radio button items.
    CheckBoxItem[] items = new CheckBoxItem[] 
    {
        new CheckBoxItem("item1"),
        new CheckBoxItem("item2"),
        new CheckBoxItem("item3"),
    };

    // First add some items.
    gcCheckedGroupBox.Items.AddRange(items);

    // Aligns the header in the center of gcCheckedGroupBox's top border.
    gcCheckedGroupBox.HeaderSettings.Alignment = HeaderAlignment.Center;

    // Enables the header's text ellipsis.
    gcCheckedGroupBox.HeaderSettings.AutoEllipsis = true;

    // Set the background and foreground of header.
    gcCheckedGroupBox.HeaderSettings.BackColor = Color.Wheat;
    gcCheckedGroupBox.HeaderSettings.ForeColor = Color.Tomato;

    // Set a new font for the header.
    gcCheckedGroupBox.HeaderSettings.Font =
        new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    
    // Enable raised effect for header's text.
    gcCheckedGroupBox.HeaderSettings.TextEffect = GrapeCity.Win.Common.TextEffect.Raised;

    // Add gcRadioGroupBo1 to the form.
    this.Controls.Add(gcCheckedGroupBox);
}
Private Sub CreateMyGcCheckedGroupBoxWithHeaderSettings()
    Dim gcCheckedGroupBox As New GcCheckedGroupBox()

    ' Set gcRadioGroupBox1's location.
    gcCheckedGroupBox.Location = New Point(10, 10)
    gcCheckedGroupBox.Text = "Center Header"

    ' Create some radio button items.
    Dim items As CheckBoxItem() = New CheckBoxItem() {New CheckBoxItem("item1"), New CheckBoxItem("item2"), New CheckBoxItem("item3")}

    ' First add some items.
    gcCheckedGroupBox.Items.AddRange(items)

    ' Aligns the header in the center of gcCheckedGroupBox's top border.
    gcCheckedGroupBox.HeaderSettings.Alignment = HeaderAlignment.Center

    ' Enables the header's text ellipsis.
    gcCheckedGroupBox.HeaderSettings.AutoEllipsis = True

    ' Set the background and foreground of header.
    gcCheckedGroupBox.HeaderSettings.BackColor = Color.Wheat
    gcCheckedGroupBox.HeaderSettings.ForeColor = Color.Tomato

    ' Set a new font for the header.
    gcCheckedGroupBox.HeaderSettings.Font = New System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

    ' Enable raised effect for header's text.
    gcCheckedGroupBox.HeaderSettings.TextEffect = TextEffect.Raised

    ' Add gcRadioGroupBo1 to the form.
    Me.Controls.Add(gcCheckedGroupBox)
End Sub
プラットフォーム

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

参照

GcGroupBoxControlBase クラス
GcGroupBoxControlBase メンバ

Send Feedback