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

項目のテキストを取得または設定します。
構文
Public Property Text As String
public string Text {get; set;}

プロパティ値

項目に表示するテキスト。
使用例
次のサンプルコードは、CheckBoxItemオブジェクトを2つ作成してGcCheckedGroupBoxコントロールに追加し、項目の一般的なプロパティを設定します。この例を実行するには、以下のコードをSystem.Windows.Forms.Formに追加し、ここで作成したメソッドをフォームのコンストラクターまたはSystem.Windows.Forms.Form.Loadイベントハンドラから呼び出す必要があります。
public void CreateMyGcCheckedGroupBox()
{
    GcCheckedGroupBox gcCheckedGroupBox1 = new GcCheckedGroupBox();
    gcCheckedGroupBox1.Location = new Point(15, 15);
    gcCheckedGroupBox1.Text = "MyGcCheckedGroupBox";

    // Create an item.
    CheckBoxItem item = new CheckBoxItem();

    // Set the Text of CheckBoxItem.
    item.Text = "MyCheckBoxItem";

    // Set a new Font from the existing font.
    item.Font = new Font(item.Font, FontStyle.Bold);

    // Set the BackColor and ForeColor properties for CheckBoxItem.
    item.BackColor = Color.LightGreen;
    item.ForeColor = Color.LightPink;

    // Disable the item.
    item.Enabled = false;

    gcCheckedGroupBox1.LayoutSettings.LayoutMode = LayoutMode.Absolute;
    // Set the location of the item.
    item.Location = new Point(15, 15);

    // Clone an item, modify its location and change its Enabled to true to enable the UI interaction.
    CheckBoxItem clonedItem = item.Clone() as CheckBoxItem;
    clonedItem.Location = new Point(15, 40);
    clonedItem.Enabled = true;

    gcCheckedGroupBox1.Items.Add(item);
    gcCheckedGroupBox1.Items.Add(clonedItem);
    this.Controls.Add(gcCheckedGroupBox1);
}
Public Sub CreateMyGcCheckedGroupBox()
    Dim gcCheckedGroupBox1 As New GcCheckedGroupBox()
    gcCheckedGroupBox1.Location = New Point(15, 15)
    gcCheckedGroupBox1.Text = "MyGcCheckedGroupBox"

    ' Create an item.
    Dim item As New CheckBoxItem()

    ' Set the Text of CheckBoxItem.
    item.Text = "MyCheckBoxItem"

    ' Set a new Font from the existing font.
    item.Font = New Font(item.Font, FontStyle.Bold)

    ' Set the BackColor and ForeColor properties for CheckBoxItem.
    item.BackColor = Color.LightGreen
    item.ForeColor = Color.LightPink

    ' Disable the item.
    item.Enabled = False

    gcCheckedGroupBox1.LayoutSettings.LayoutMode = LayoutMode.Absolute
    ' Set the location of the item.
    item.Location = New Point(15, 15)

    ' Clone an item, modify its location and change its Enabled to true to enable the UI interaction.
    Dim clonedItem As CheckBoxItem = TryCast(item.Clone(), CheckBoxItem)
    clonedItem.Location = New Point(15, 40)
    clonedItem.Enabled = True

    gcCheckedGroupBox1.Items.Add(item)
    gcCheckedGroupBox1.Items.Add(clonedItem)
    Me.Controls.Add(gcCheckedGroupBox1)
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

参照

CheckBoxItem クラス
CheckBoxItem メンバ

Send Feedback