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

ヘッダのテキストが、指定されたヘッダの長さを超えていることを示す省略記号(...)を、ヘッダの右端に表示するかどうかを示す値を取得または設定します。
構文
Public Property AutoEllipsis As Boolean
public bool AutoEllipsis {get; set;}

プロパティ値

追加のヘッダテキストがあることを省略記号によって示す場合はtrue、それ以外の場合はfalse。デフォルトはfalseです。
解説
ヘッダの幅を超えるテキストを表示するには、AutoEllipsisをtrueに設定します。こうすると、マウスポインタがコントロールの上を通過するときに、ヘッダテキスト全体を表示するツールチップが表示されます。
使用例

次のサンプルコードは、GcRadioGroupBox.HeaderSettingsプロパティ上でAutoEllipsistrueに設定し、ヘッダのテキストが長すぎるときに省略記号が表示されるようにします。このサンプルコードを実行するには、以下のコードを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