ListBox.MultiColumn プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As ListBox Dim value As Boolean value = instance.MultiColumn instance.MultiColumn = value
/** @property */ public boolean get_MultiColumn () /** @property */ public void set_MultiColumn (boolean value)
ListBox が複数列をサポートしている場合は true。それ以外の場合は false。既定値は false です。


複数列の ListBox では、必要に応じた列数に項目が配置されるため、垂直方向のスクロールが不要になります。ユーザーは、現在表示されていない列に移動する場合はキーボードを使用できます。水平スクロール バーを表示して、ListBox 内の表示領域に現在表示されていない列にスクロールできるようにするには、HorizontalScrollbar プロパティを true に設定します。ColumnWidth プロパティの値によって各列の幅が決まります。

ColumnWidth プロパティと MultiColumn プロパティを使用して、複数の列に項目を表示する ListBox コントロールを作成する方法を次のコード例に示します。この例では、listBox1 という名前の ListBox コントロールがフォームに追加されている必要があります。
Private Sub SetupMyMultiColumn() Dim x As Integer ' Add items to the ListBox. For x = 0 To 50 ListBox1.Items.Add("Items " + x.ToString()) Next x ' Display items in columns. ListBox1.MultiColumn = True ' Determine the width of the items in the list to get the best column width setting. Dim width As Integer = CInt(ListBox1.CreateGraphics().MeasureString(ListBox1.Items(ListBox1.Items.Count - 1).ToString(), _ ListBox1.Font).Width) ' Set the column width based on the width of each item in the list. ListBox1.ColumnWidth = width End Sub
private void SetupMyMultiColumn() { // Add items to the ListBox. for (int x = 0; x < 50; x++) { listBox1.Items.Add("Items " + x.ToString()); } // Display items in columns. listBox1.MultiColumn = true; // Determine the width of the items in the list to get the best column width setting. int width = (int) listBox1.CreateGraphics().MeasureString(listBox1.Items[listBox1.Items.Count -1].ToString(), listBox1.Font).Width; // Set the column width based on the width of each item in the list. listBox1.ColumnWidth = width; }
private: void SetupMyMultiColumn() { // Add items to the ListBox. for ( int x = 0; x < 50; x++ ) { listBox1->Items->Add( String::Format( "Items {0}", x ) ); } listBox1->MultiColumn = true; // Determine the width of the items in the list to get the best column width setting. int width = (int)listBox1->CreateGraphics()->MeasureString( listBox1->Items[ listBox1->Items->Count - 1 ]->ToString(), listBox1->Font ).Width; // Set the column width based on the width of each item in the list. listBox1->ColumnWidth = width; }
private void SetupMyMultiColumn() { // Add items to the ListBox. for (int x = 0; x < 50; x++) { listBox1.get_Items().Add("Items " + System.Convert.ToString(x)); } // Display items in columns. listBox1.set_MultiColumn(true); // Determine the width of the items in the list to get the best column // width setting. int width = (int)(listBox1.CreateGraphics().MeasureString(listBox1. get_Items().get_Item((listBox1.get_Items().get_Count() - 1)). ToString(), listBox1.get_Font()).get_Width()); // Set the column width based on the width of each item in the list. listBox1.set_ColumnWidth(width); } //SetupMyMultiColumn

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からListBox.MultiColumn プロパティを検索する場合は、下記のリンクをクリックしてください。

- ListBox.MultiColumn プロパティのページへのリンク