Posts
[VB.NET]如何自製使用者控制項測試容器(User Control Test Container)
Private Sub SetPreviewControl(ByVal c As Control) With pnlControlContainer.Controls .Clear() .Add(c) End With Me.PropertyGrid1.SelectedObject = c End Sub</pre></div><p>如此簡易的User Control Test Container就完成了。</p><p> </p><p>這邊附上我寫好的範例程式,主要介面仿照User Test Container。除提供User Test Container的功能外,另加上語系切換,與預覽表單的功能。程式介面外觀如下:</p><p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" width="602" height="522" src="\images\posts\13810\image_thumb.png" /></a></p><p> </p> <h2>Download</h2><p><a href="http://Files.Dotblogs.com.tw/larrynung/1002/2010227232727262.zip">User Control Test Container.zip</p>
read morePosts
[VB.NET]調整TreeView或TreeNode下的節點
Private Function GetAllNodes(ByVal treeOrNode As Object) As TreeNode() If Not TypeOf treeOrNode Is TreeNode AndAlso Not TypeOf treeOrNode Is TreeView Then Throw New ArgumentException("Error param type!!") End If Dim nodes As New List(Of TreeNode) If TypeOf treeOrNode Is TreeNode Then nodes.Add(treeOrNode) End If For Each tn As TreeNode In treeOrNode.Nodes nodes.AddRange(GetAllNodes(tn)) Next Return nodes.ToArray End Function</pre></div> Public Module TreeViewExtension
#Region “Private Method” Private Function GetAllTreeNodes(ByVal treeOrNode As Object) As TreeNode() If Not TypeOf treeOrNode Is TreeNode AndAlso Not TypeOf treeOrNode Is TreeView Then Throw New ArgumentException(“Error param type!
read morePosts
[VB.NET]取得TreeView或TreeNode下的樹葉節點
Private Function GetAllNodes(ByVal treeOrNode As Object) As TreeNode() If Not TypeOf treeOrNode Is TreeNode AndAlso Not TypeOf treeOrNode Is TreeView Then Throw New ArgumentException("Error param type!!") End If Dim nodes As New List(Of TreeNode) If TypeOf treeOrNode Is TreeNode Then nodes.Add(treeOrNode) End If For Each tn As TreeNode In treeOrNode.Nodes nodes.AddRange(GetAllNodes(tn)) Next Return nodes.ToArray End Function</pre></div> Public Module TreeViewExtension
#Region “Private Method” Private Function GetAllTreeNodes(ByVal treeOrNode As Object) As TreeNode() If Not TypeOf treeOrNode Is TreeNode AndAlso Not TypeOf treeOrNode Is TreeView Then Throw New ArgumentException(“Error param type!
read more