ListBox.BeginUpdate メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ListBox.BeginUpdate メソッドの意味・解説 

ListBox.BeginUpdate メソッド

項目を ListBox1 つずつ追加するときにパフォーマンス維持するには、EndUpdate メソッド呼び出されるまでコントロールを再描画ないようにします。

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

Dim instance As ListBox

instance.BeginUpdate
public void BeginUpdate ()
public:
void BeginUpdate ()
public void BeginUpdate ()
解説解説

複数の項目を ListBox追加する場合は、ListBoxItems プロパティ使用してアクセスする、ListBox.ObjectCollection クラスの AddRange メソッド使用することをお勧めます。この方法を使用すると、項目の配列1 回操作リスト追加できます。しかし、ListBox.ObjectCollection クラスAdd メソッド使用して 1 つずつ項目を追加する場合は、BeginUpdate メソッド使用して、項目がリスト追加されるたびに ListBox が再描画されるという状況回避できます。項目をリスト追加するタスク完了した後でEndUpdate メソッド呼び出して ListBox を再描画できるようにします。リスト多数の項目を追加する場合は、この方法で項目を追加すると、ListBox描画するときにちらつきません。

使用例使用例

5,000 の項目を ListBox追加するときに、BeginUpdate メソッドEndUpdate メソッド使用するコード例次に示します。この例では、listBox1 という名前の ListBox コントロールForm追加されており、このメソッドがそのフォーム内に含まれ、そこから呼び出される必要があります

Public Sub AddToMyListBox()
    ' Stop the ListBox from drawing while items are added.
    listBox1.BeginUpdate()
       
    ' Loop through and add five thousand new items.
    Dim x As Integer
    For x = 1 To 4999
        listBox1.Items.Add("Item " & x.ToString())
    Next x
    ' End the update process and force a repaint of the ListBox.
    listBox1.EndUpdate()
End Sub

public void AddToMyListBox()
{
   // Stop the ListBox from drawing while items are added.
   listBox1.BeginUpdate();

   // Loop through and add five thousand new items.
   for(int x = 1; x < 5000; x++)
   {
      listBox1.Items.Add("Item " + x.ToString());   
   }
   // End the update process and force a repaint of the ListBox.
   listBox1.EndUpdate();
}

void AddToMyListBox()
{
   // Stop the ListBox from drawing while items are added.
   listBox1->BeginUpdate();

   // Loop through and add five thousand new items.
   for ( int x = 1; x < 5000; x++ )
   {
      listBox1->Items->Add( String::Format( "Item {0}", x ) );
   }
   listBox1->EndUpdate();
}
public void AddToMyListBox()
{
    // Stop the ListBox from drawing while items are added.
    listBox1.BeginUpdate();

    // Loop through and add five thousand new items.
    for (int x = 1; x < 5000; x++) {
        listBox1.get_Items().Add(("Item" + (new Integer(x)).ToString()));
    }

    // End the update process and force a repaint of the ListBox.
    listBox1.EndUpdate();
} //AddToMyListBox
function AddToMyListBox(){
    // Stop the ListBox from drawing while items are added.
    listBox1.BeginUpdate()
       
    // Loop through and add five thousand new items.
    for(var x = 0; x < 5000; x++)
        listBox1.Items.Add("Item " + x.ToString())
    // End the update process and force a repaint of the ListBox.
    listBox1.EndUpdate()
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

ListBox.BeginUpdate メソッドのお隣キーワード
検索ランキング

   

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



ListBox.BeginUpdate メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS