Private Sub tvw1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvw1.AfterSelect
Dim Tstbl As String
If e.Action <> TreeViewAction.Unknown Then
Select Case UCase(e.Node.Tag)
Case "China"
'数据查询
'.......................
End Select
End If
End Sub
13 个解决方案
#1
AfterSelect是发生在由其它的节点改到所点的节点时发生的,第二次点的时候所以不会发生,你可以写一个在Click事件里,也可以用其它的方法来刷新你的数据.
#2
DOTNET的TREEVIEW的确很烂,我的方法:
Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
Dim ClickNode As Windows.Forms.TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y)
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
'*** 测试是否CLICK到文字,而非CLICK到“+”部分
If r.Contains(e.X, e.Y) Then
MsgBox("CLICK")
End If
End If
End Sub
Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
Dim ClickNode As Windows.Forms.TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y)
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
'*** 测试是否CLICK到文字,而非CLICK到“+”部分
If r.Contains(e.X, e.Y) Then
MsgBox("CLICK")
End If
End If
End Sub
#3
在Click事件里处理代码呀
不过我有点纳闷,既然你的节点没有改变,所有你的查询条件也没变,那么就不需要重新再查询填充网格了呀!
不过我有点纳闷,既然你的节点没有改变,所有你的查询条件也没变,那么就不需要重新再查询填充网格了呀!
#4
既然你的节点没有改变,所以你的查询条件也没变,那么就不需要重新再查询填充网格了呀!
#5
如果你要你的效果 就在mousedown事件里 编写把
#6
Click中的处理可以这样:
Private Sub TreeView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.Click
Dim tmpNode As TreeNode
tmpNode = Me.TreeView1.GetNodeAt(Me.TreeView1.PointToClient(Cursor.Position))
If (tmpNode Is Nothing) Then
Return
End If
'Your code here
'Me.Text = tmpNode.Text
End Sub
Private Sub TreeView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.Click
Dim tmpNode As TreeNode
tmpNode = Me.TreeView1.GetNodeAt(Me.TreeView1.PointToClient(Cursor.Position))
If (tmpNode Is Nothing) Then
Return
End If
'Your code here
'Me.Text = tmpNode.Text
End Sub
#7
第二次焦点还在原来的位置,第一次单击以后,把焦点置走
#8
帮你顶一下!
#9
simon8181兄弟,把焦点之走是不行的,那样还会触发该事件的哟。看看大家还有没有其他的方法啊,特急得啊
#10
longqiaoman(龙桥人) 兄弟,在vb理是NodeClick事件,鼠标单击和通过键盘都可以触发该事件,所以Brunhild兄的方案只实现了一半,我现在想要的是和VB中完全一样的效果啊。郁闷中阿。。。。。。。。。。。。。。。。。。。。。
#11
太感谢大家的帮忙了阿,问题解决了,谢谢!!!
Private Sub tvw1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tvw1.Click
Dim ClickNode As Windows.Forms.TreeNode = Me.tvw1.GetNodeAt(Me.tvw1.PointToClient(Cursor.Position))
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
If r.Contains(Me.tvw1.PointToClient(Cursor.Position)) Then
Select Case ClickNode.Tag
Case "要件Tag"
MsgBox("要件Tag")
Case "要件Child Tag"
MsgBox("要件Child Tag")
Case Else
MsgBox("Else")
End Select
End If
End If
End Sub
Private Sub tvw1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tvw1.Click
Dim ClickNode As Windows.Forms.TreeNode = Me.tvw1.GetNodeAt(Me.tvw1.PointToClient(Cursor.Position))
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
If r.Contains(Me.tvw1.PointToClient(Cursor.Position)) Then
Select Case ClickNode.Tag
Case "要件Tag"
MsgBox("要件Tag")
Case "要件Child Tag"
MsgBox("要件Child Tag")
Case Else
MsgBox("Else")
End Select
End If
End If
End Sub
#12
到这里面去找找吧:http://www.evget.com/view/viewCategoryProduct.asp?language=&mode=&productTypeId=&categoryId=21
.Net自带的哪些控件实现复杂功能要累死人的
.Net自带的哪些控件实现复杂功能要累死人的
#13
个人喜欢 Brunhild() 的方法
#1
AfterSelect是发生在由其它的节点改到所点的节点时发生的,第二次点的时候所以不会发生,你可以写一个在Click事件里,也可以用其它的方法来刷新你的数据.
#2
DOTNET的TREEVIEW的确很烂,我的方法:
Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
Dim ClickNode As Windows.Forms.TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y)
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
'*** 测试是否CLICK到文字,而非CLICK到“+”部分
If r.Contains(e.X, e.Y) Then
MsgBox("CLICK")
End If
End If
End Sub
Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
Dim ClickNode As Windows.Forms.TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y)
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
'*** 测试是否CLICK到文字,而非CLICK到“+”部分
If r.Contains(e.X, e.Y) Then
MsgBox("CLICK")
End If
End If
End Sub
#3
在Click事件里处理代码呀
不过我有点纳闷,既然你的节点没有改变,所有你的查询条件也没变,那么就不需要重新再查询填充网格了呀!
不过我有点纳闷,既然你的节点没有改变,所有你的查询条件也没变,那么就不需要重新再查询填充网格了呀!
#4
既然你的节点没有改变,所以你的查询条件也没变,那么就不需要重新再查询填充网格了呀!
#5
如果你要你的效果 就在mousedown事件里 编写把
#6
Click中的处理可以这样:
Private Sub TreeView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.Click
Dim tmpNode As TreeNode
tmpNode = Me.TreeView1.GetNodeAt(Me.TreeView1.PointToClient(Cursor.Position))
If (tmpNode Is Nothing) Then
Return
End If
'Your code here
'Me.Text = tmpNode.Text
End Sub
Private Sub TreeView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.Click
Dim tmpNode As TreeNode
tmpNode = Me.TreeView1.GetNodeAt(Me.TreeView1.PointToClient(Cursor.Position))
If (tmpNode Is Nothing) Then
Return
End If
'Your code here
'Me.Text = tmpNode.Text
End Sub
#7
第二次焦点还在原来的位置,第一次单击以后,把焦点置走
#8
帮你顶一下!
#9
simon8181兄弟,把焦点之走是不行的,那样还会触发该事件的哟。看看大家还有没有其他的方法啊,特急得啊
#10
longqiaoman(龙桥人) 兄弟,在vb理是NodeClick事件,鼠标单击和通过键盘都可以触发该事件,所以Brunhild兄的方案只实现了一半,我现在想要的是和VB中完全一样的效果啊。郁闷中阿。。。。。。。。。。。。。。。。。。。。。
#11
太感谢大家的帮忙了阿,问题解决了,谢谢!!!
Private Sub tvw1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tvw1.Click
Dim ClickNode As Windows.Forms.TreeNode = Me.tvw1.GetNodeAt(Me.tvw1.PointToClient(Cursor.Position))
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
If r.Contains(Me.tvw1.PointToClient(Cursor.Position)) Then
Select Case ClickNode.Tag
Case "要件Tag"
MsgBox("要件Tag")
Case "要件Child Tag"
MsgBox("要件Child Tag")
Case Else
MsgBox("Else")
End Select
End If
End If
End Sub
Private Sub tvw1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tvw1.Click
Dim ClickNode As Windows.Forms.TreeNode = Me.tvw1.GetNodeAt(Me.tvw1.PointToClient(Cursor.Position))
If Not ClickNode Is Nothing Then
Dim r As Drawing.Rectangle = ClickNode.Bounds
If r.Contains(Me.tvw1.PointToClient(Cursor.Position)) Then
Select Case ClickNode.Tag
Case "要件Tag"
MsgBox("要件Tag")
Case "要件Child Tag"
MsgBox("要件Child Tag")
Case Else
MsgBox("Else")
End Select
End If
End If
End Sub
#12
到这里面去找找吧:http://www.evget.com/view/viewCategoryProduct.asp?language=&mode=&productTypeId=&categoryId=21
.Net自带的哪些控件实现复杂功能要累死人的
.Net自带的哪些控件实现复杂功能要累死人的
#13
个人喜欢 Brunhild() 的方法