本文整理汇总了VB.NET中System.Windows.Forms.TreeView.BeginUpdate方法的典型用法代码示例。如果您正苦于以下问题:VB.NET TreeView.BeginUpdate方法的具体用法?VB.NET TreeView.BeginUpdate怎么用?VB.NET TreeView.BeginUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeView 的用法示例。
在下文中一共展示了TreeView.BeginUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: Customer
Public Class Customer
Inherits [Object]
Private custName As String = ""
Friend custOrders As New ArrayList()
Public Sub New(ByVal customername As String)
Me.custName = customername
End Sub
Public Property CustomerName() As String
Get
Return Me.custName
End Get
Set(ByVal Value As String)
Me.custName = Value
End Set
End Property
Public ReadOnly Property CustomerOrders() As ArrayList
Get
Return Me.custOrders
End Get
End Property
End Class
Public Class Order
Inherits [Object]
Private ordID As String
Public Sub New(ByVal orderid As String)
Me.ordID = orderid
End Sub
Public Property OrderID() As String
Get
Return Me.ordID
End Get
Set(ByVal Value As String)
Me.ordID = Value
End Set
End Property
End Class
' Create a new ArrayList to hold the Customer objects.
Private customerArray As New ArrayList()
Private Sub FillMyTreeView()
' Add customers to the ArrayList of Customer objects.
Dim x As Integer
For x = 0 To 999
customerArray.Add(New Customer("Customer" + x.ToString()))
Next x
' Add orders to each Customer object in the ArrayList.
Dim customer1 As Customer
For Each customer1 In customerArray
Dim y As Integer
For y = 0 To 14
customer1.CustomerOrders.Add(New Order("Order" + y.ToString()))
Next y
Next customer1
' Display a wait cursor while the TreeNodes are being created.
Cursor.Current = New Cursor("MyWait.cur")
' Suppress repainting the TreeView until all the objects have been created.
treeView1.BeginUpdate()
' Clear the TreeView each time the method is called.
treeView1.Nodes.Clear()
' Add a root TreeNode for each Customer object in the ArrayList.
Dim customer2 As Customer
For Each customer2 In customerArray
treeView1.Nodes.Add(New TreeNode(customer2.CustomerName))
' Add a child TreeNode for each Order object in the current Customer object.
Dim order1 As Order
For Each order1 In customer2.CustomerOrders
treeView1.Nodes(customerArray.IndexOf(customer2)).Nodes.Add( _
New TreeNode(customer2.CustomerName + "." + order1.OrderID))
Next order1
Next customer2
' Reset the cursor to the default for all controls.
Cursor.Current = System.Windows.Forms.Cursors.Default
' Begin repainting the TreeView.
treeView1.EndUpdate()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:91,代码来源:TreeView.BeginUpdate
注:本文中的System.Windows.Forms.TreeView.BeginUpdate方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论