本記事はWindowsアプリケーションのTipsです。
ComboBoxのドロップダウンリストの幅は、DorpDownWidthプロパティで変更することが可能です。
VBの例
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strData() As String = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}
'コンボボックスにアイテムを追加する
ComboBox1.Items.AddRange(strData)
'ドロップダウンリストの幅を変更する
ComboBox1.DropDownWidth = 200
End Sub
C#の例
private void Form1_Load(object sender, EventArgs e)
{
string[] strData = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L" };
//コンボボックスにアイテムを追加する
comboBox1.Items.AddRange(strData);
//ドロップダウンリストの幅を変更する
comboBox1.DropDownWidth = 200;
}
Please follow and like us:
コメント