Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click in a treeview

Status
Not open for further replies.

231166

Programmer
Apr 5, 2005
104
0
0
FR
Hi,

Is it possible to see a hand ( like in a listview) on each node, in a treeview, when we click on a node, instead of seeing the arrow of the mouse.

I think it is better for a user to see the hand of the hypertext link instead of seeing this arrow.

Secondly,could you tell me how i can create a sub with the event 'nodemouseclick', because i can not see this event in the event list.

Thanks a lot for your help.

Best regards.

Nathalie
 
Yes; put it in the AfterSelect Event.

TV1.Cursor=Cursors.Hand

Don't forget to return it to default...


I hope this helps.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Sorry, my mistake. I checked some code and I put it in the MouseDown event.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Hi,
So you mean the code TV1.Cursor = Cursors.Hand is not in the after select event but in the mousedown event.

Thanks for your help.

Regards.
Nathalie
 
Nathalie:

Code:
Private Sub TV1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TV1.MouseDown

        If e.Button = MouseButtons.Left Then
            Try
                Select Case TV1.SelectedNode.Tag
                    Case "FLD"
                        Clipboard.SetDataObject(" [" & TV1.SelectedNode.Text & "]", True)
                  [COLOR=blue][b]TV1.Cursor = Cursors.Hand[/b][/color]
                        TV1.DoDragDrop(" [" & TV1.SelectedNode.Text & "]", DragDropEffects.Copy)
                    Case "VIEW"
                        Dim VW As SQLDMO.View = New SQLDMO.View
                        [COLOR=blue][b]TV1.Cursor = Cursors.Hand[/b][/color]
                        TV1.DoDragDrop(VW.Script, DragDropEffects.Copy)
                        'txtSQL.Text = VW.Script
                    Case "DB"
                        Dim VW As SQLDMO.Database = New SQLDMO.Database
                      [COLOR=blue]  [b]TV1.Cursor = Cursors.Hand[/b][/color]
                        TV1.DoDragDrop(VW.Script, DragDropEffects.Copy)
                        'txtSQL.Text = VW.Script
                End Select
            Catch ex As Exception

            End Try
        End If
        TV1.Cursor = Cursors.Default

    End Sub

This doesn't work for a parent node, but I hope it helps.

PS: The drag-drop is not 100% yet, so if you have any ideas on that, I'd love it.



Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top