ListBox.EndUpdate 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
方法暂停BeginUpdate()绘制后恢复绘制ListBox控件。
public:
void EndUpdate();
public void EndUpdate();
member this.EndUpdate : unit -> unit
Public Sub EndUpdate ()
示例
下面的代码示例在向 a ListBox中添加 5000 个项时使用 BeginUpdate and 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.Items.Add("Item " + x.ToString());
}
// End the update process and force a repaint of the ListBox.
listBox1.EndUpdate();
}
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
注解
向其中添加项