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

ListBox.EndUpdate メソッド

BeginUpdate メソッドによって中断されていた ListBox コントロール描画再開します

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

Dim instance As ListBox

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

ListBox に項目を追加するには、ListBoxItems プロパティ使用してアクセスする ListBox.ObjectCollection クラスの AddRange メソッド使用する方法お勧めます。これにより、項目の配列リスト一度追加できます。しかし、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.EndUpdate メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からListBox.EndUpdate メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からListBox.EndUpdate メソッド を検索

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS