Re: TreeView: right-click
Peter Osucha <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
Thanks, Patrick. Works like a charm. -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:[email protected]] On Behalf Of Patrick Steele Sent: Sunday, May 06, 2007 9:52 PM To: [email protected] Subject: Re: [DOTNET-WINFORMS] TreeView: right-click TreeView.GetNodeAt(x,y) --- Patrick Steele http://weblogs.asp.net/psteele -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:[email protected]] On Behalf Of Peter Osucha Sent: Sunday, May 06, 2007 9:38 PM To: [email protected] Subject: Re: [DOTNET-WINFORMS] TreeView: right-click Patrick, First, it must be in the mousedown event. What is available for finding the clicked node in this event? Nothing else has happened to the tree yet when this event fires. I do have access to the x, y, and location variables form the MouseEventArgs argument. How do you find the clicked node from these? Peter -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:[email protected]] On Behalf Of Patrick Steele Sent: Sunday, May 06, 2007 7:42 AM To: [email protected] Subject: Re: [DOTNET-WINFORMS] TreeView: right-click In the MouseDown (or maybe MouseUp) event, if the right-mouse was clicked, set the SelectedNode property to the Node that was clicked on. --- Patrick Steele http://weblogs.asp.net/psteele -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:[email protected]] On Behalf Of Peter Osucha Sent: Sunday, May 06, 2007 1:34 AM To: [email protected] Subject: [DOTNET-WINFORMS] TreeView: right-click And since it's late and my brain isn't working well right now, one more... I have a TreeView control on a form with a bunch of nodes displayed. If I 'left-click', the treeview highlight shows on the item I clicked. However, if I 'right-click', it doesn't. How do I change the TreeView's behavior so that the 'right-click' moves the highlight just like the 'left-click' does (the same behavior that happends in Windows Explorer), please? Peter