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

グループボックスコントロールの上部にあるヘッダの水平方向の配置を取得または設定します。
構文
Public Property Alignment As HeaderAlignment
public HeaderAlignment Alignment {get; set;}

プロパティ値

HeaderAlignment値の1つ。デフォルト値はHeaderAlignment.Leftです。
例外
例外解説
System.ComponentModel.InvalidEnumArgumentException指定された値がHeaderAlignment値の1つではありません。
使用例

次のサンプルコードは、GcRadioGroupBoxを作成し、GcRadioGroupBox.HeaderSettingsプロパティ上でAlignmentプロパティを設定して、ヘッダを上境界線の中央に配置します。このサンプルコードを実行するには、以下のコードをSystem.Windows.Forms.Formプロジェクトに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出します。

private void CreateGcRadioGroupBoxWithHeaderSettings()
{
    GcRadioGroupBox gcRadioGroupBox1 = new GcRadioGroupBox();

    // Set gcRadioGroupBox1's location.
    gcRadioGroupBox1.Location = new Point(10, 10);
    gcRadioGroupBox1.Size = new Size(130, 100);

    // Set up the group style for this control.
    gcRadioGroupBox1.GroupStyle = GroupStyle.TopLine;

    // Set HeaderType and Header's text.
    gcRadioGroupBox1.HeaderType = HeaderType.ExpanderAndText;
    gcRadioGroupBox1.Text = "All Iems";

    // Create some radio button items.
    RadioButtonItem[] items = new RadioButtonItem[] 
    {
        new RadioButtonItem("item&1"),
        new RadioButtonItem("item&2"),
        new RadioButtonItem("item&3"),
        new RadioButtonItem("item&4"),
        new RadioButtonItem("item&5"),
    };

    // Add some items.
    gcRadioGroupBox1.Items.AddRange(items);

    // Align the header to the center of the top border.
    gcRadioGroupBox1.HeaderSettings.Alignment = HeaderAlignment.Center;

    // Enable the header's  text to ellipsis when it is too long.
    gcRadioGroupBox1.HeaderSettings.AutoEllipsis = true;

    // Set the backgroud and foreground color of the header.
    gcRadioGroupBox1.HeaderSettings.BackColor = Color.GreenYellow;
    gcRadioGroupBox1.HeaderSettings.ForeColor = Color.Tomato;

    // Set a new font to the header.
    gcRadioGroupBox1.HeaderSettings.Font =
        new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    
    // Set the effect of the header text.
    gcRadioGroupBox1.HeaderSettings.TextEffect = GrapeCity.Win.Common.TextEffect.Raised;

    // Customize the layout of items through LayoutSettings.
    gcRadioGroupBox1.LayoutSettings.LayoutMode = LayoutMode.Table;
    gcRadioGroupBox1.LayoutSettings.Orientation = System.Windows.Forms.Orientation.Vertical;
    gcRadioGroupBox1.LayoutSettings.RowCount = 3;
    gcRadioGroupBox1.LayoutSettings.HorizontalAdjustment = GrapeCity.Win.Containers.LineAdjustment.Distributed;
    gcRadioGroupBox1.LayoutSettings.VerticalAdjustment = GrapeCity.Win.Containers.LineAdjustment.Average;

    // Add gcRadioGroupBo1 to the form.
    this.Controls.Add(gcRadioGroupBox1);
}
Private Sub CreateGcRadioGroupBoxWithHeaderSettings()
    Dim gcRadioGroupBox1 As New GcRadioGroupBox()

    ' Set gcRadioGroupBox1's location.
    gcRadioGroupBox1.Location = New Point(10, 10)
    gcRadioGroupBox1.Size = New Size(130, 100)

    ' Set up the group style for this control.
    gcRadioGroupBox1.GroupStyle = GroupStyle.TopLine

    ' Set HeaderType and Header's text.
    gcRadioGroupBox1.HeaderType = HeaderType.ExpanderAndText
    gcRadioGroupBox1.Text = "All Iems"

    ' Create some radio button items.
    Dim items As RadioButtonItem() = New RadioButtonItem() {New RadioButtonItem("item&1"), New RadioButtonItem("item&2"), New RadioButtonItem("item&3"), New RadioButtonItem("item&4"), New RadioButtonItem("item&5")}

    ' Add some items.
    gcRadioGroupBox1.Items.AddRange(items)

    ' Align the header to the center of the top border.
    gcRadioGroupBox1.HeaderSettings.Alignment = HeaderAlignment.Center

    ' Enable the header's  text to ellipsis when it is too long.
    gcRadioGroupBox1.HeaderSettings.AutoEllipsis = True

    ' Set the backgroud and foreground color of the header.
    gcRadioGroupBox1.HeaderSettings.BackColor = Color.GreenYellow
    gcRadioGroupBox1.HeaderSettings.ForeColor = Color.Tomato

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

    ' Set the effect of the header text.
    gcRadioGroupBox1.HeaderSettings.TextEffect = TextEffect.Raised

    ' Customize the layout of items through LayoutSettings.
    gcRadioGroupBox1.LayoutSettings.LayoutMode = LayoutMode.Table
    gcRadioGroupBox1.LayoutSettings.Orientation = System.Windows.Forms.Orientation.Vertical
    gcRadioGroupBox1.LayoutSettings.RowCount = 3
    gcRadioGroupBox1.LayoutSettings.HorizontalAdjustment = LineAdjustment.Distributed
    gcRadioGroupBox1.LayoutSettings.VerticalAdjustment = LineAdjustment.Average

    ' Add gcRadioGroupBo1 to the form.
    Me.Controls.Add(gcRadioGroupBox1)
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

参照

GroupHeaderSettings クラス
GroupHeaderSettings メンバ

Send Feedback