ListBox.PreferredHeight プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ListBox.PreferredHeight プロパティの意味・解説 

ListBox.PreferredHeight プロパティ

ListBox 内のすべての項目を組み合わせた高さを取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As ListBox
Dim value As Integer

value = instance.PreferredHeight
public int PreferredHeight { get;
 }
public:
property int PreferredHeight {
    int get ();
}
/** @property */
public int get_PreferredHeight ()
public function get PreferredHeight
 () : int

プロパティ
コントロール内のすべての項目を組み合わせた高さ (ピクセル単位)。

解説解説
使用例使用例

ListBoxすべての項目をスクロール バー使用せず表示する目的で、PreferredHeight プロパティの値に基づいて ListBoxSize プロパティ設定する方法次のコード例示します。この例では、listBox1 という名前の ListBox コントロールフォーム追加されている必要があります

Private Sub SizeMyListBox()
   ' Add items to the ListBox.
   Dim x As Integer
   For x = 0 To 19
      listBox1.Items.Add(("Item " + x.ToString()))
   Next x
   ' Set the height of the ListBox to the preferred height to display
 all items.
   listBox1.Height = listBox1.PreferredHeight
End Sub 'SizeMyListBox
private void SizeMyListBox()
{
   // Add items to the ListBox.
   for(int x = 0; x < 20; x++)
   {
      listBox1.Items.Add("Item " + x.ToString());
   }
   // Set the height of the ListBox to the preferred height to display
 all items.
   listBox1.Height = listBox1.PreferredHeight;
}
private:
   void SizeMyListBox()
   {
      // Add items to the ListBox.
      for ( int x = 0; x < 20; x++ )
      {
         listBox1->Items->Add( String::Format( "Item {0}", x ) );
      }
      listBox1->Height = listBox1->PreferredHeight;
   }
private void SizeMyListBox()
{
    // Add items to the ListBox.
    for (int x = 0; x < 20; x++) {
        listBox1.get_Items().Add("Item " + Convert.ToString(x));
    }
    // Set the height of the ListBox to the preferred height 
    // to display all items.
    listBox1.set_Height(listBox1.get_PreferredHeight());
} //SizeMyListBox
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からListBox.PreferredHeight プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からListBox.PreferredHeight プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からListBox.PreferredHeight プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ListBox.PreferredHeight プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ListBox.PreferredHeight プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS