[ad#ad-336×280]
StatusStripにドロップダウンボタンを表示するには、ToolStripDropDownButtonを使用します。
アイテムはDropDownItemsプロパティのAddメソッドで追加します。
下記はStatusStripにドロップダウンボタンを表示する例です。
VBの例
' フォームロード時の処理
Private Sub Form3_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim dropDownButton As New ToolStripDropDownButton
'アイテムの追加
dropDownButton.DropDownItems.Add("コピー(&C)")
dropDownButton.DropDownItems.Add("切り取り(&X)")
dropDownButton.DropDownItems.Add("貼り付け(&P)")
dropDownButton.Text = "編集" 'テキストの設定
dropDownButton.AutoSize = False 'ToolStripDropDownButtonの幅を任意の値に変更できるようにする
dropDownButton.Width = 70 'ToolStripDropDownButtonの幅を70にする
StatusStrip1.Items.Add(dropDownButton)
End Sub
C#の例
// フォームロード時の処理
private void Form3_Load(object sender, EventArgs e)
{
ToolStripDropDownButton dropDownButton = new ToolStripDropDownButton();
// アイテムの追加
dropDownButton.DropDownItems.Add("コピー(&C)");
dropDownButton.DropDownItems.Add("切り取り(&X)");
dropDownButton.DropDownItems.Add("貼り付け(&P)");
dropDownButton.Text = "編集"; // テキストの設定
dropDownButton.AutoSize = false; // ToolStripDropDownButtonの幅を任意の値に変更できるようにする
dropDownButton.Width = 70; // ToolStripDropDownButtonの幅を70にする
statusStrip1.Items.Add(dropDownButton);
}
Please follow and like us:


コメント