PowerTools PlusPak for Windows Forms 8.0J
HeaderAlignment 列挙体
使用例 使用例 

グループボックスヘッダをグループボックスの上部でどのように揃えるかを指定します。
構文
Public Enum HeaderAlignment 
   Inherits System.Enum
public enum HeaderAlignment : System.Enum 
メンバ
メンバ解説
Centerヘッダをグループボックスの上部中央に揃えることを指定します。
Leftヘッダをグループボックスの上部左側に揃えることを指定します。
Rightヘッダをグループボックスの上部右側に揃えることを指定します。
解説
この列挙体は、GroupHeaderSettings.Alignmentで使用されます。
使用例

次のサンプルコードは、GcRadioGroupBoxを作成し、GcRadioGroupBox.HeaderSettingsプロパティ上でGroupHeaderSettings.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
継承階層

System.Object
   System.ValueType
      System.Enum
         GrapeCity.Win.Containers.HeaderAlignment

プラットフォーム

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

参照

GrapeCity.Win.Containers 名前空間
Alignment プロパティ
Alignment プロパティ

Send Feedback