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

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

プロパティ値

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

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

    // Set the Text of RadioButtonItem.
    item.Text = "MyRadioButtonItem";

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

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

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

    gcRadioGroupBox1.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.
    RadioButtonItem clonedItem = item.Clone() as RadioButtonItem;
    clonedItem.Location = new Point(15, 40);
    clonedItem.Enabled = true;

    gcRadioGroupBox1.Items.Add(item);
    gcRadioGroupBox1.Items.Add(clonedItem);
    this.Controls.Add(gcRadioGroupBox1);
}
Public Sub CreateMyGcRadioGroupBox()
    Dim gcRadioGroupBox1 As New GcRadioGroupBox()
    gcRadioGroupBox1.Location = New Point(15, 15)
    gcRadioGroupBox1.Text = "MyGcRadioGroupBox"

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

    ' Set the Text of RadioButtonItem.
    item.Text = "MyRadioButtonItem"

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

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

    ' Disable the item.
    item.Enabled = False

    gcRadioGroupBox1.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 RadioButtonItem = TryCast(item.Clone(), RadioButtonItem)
    clonedItem.Location = New Point(15, 40)
    clonedItem.Enabled = True

    gcRadioGroupBox1.Items.Add(item)
    gcRadioGroupBox1.Items.Add(clonedItem)
    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

参照

RadioButtonItem クラス
RadioButtonItem メンバ

Send Feedback