Solved

VB.net Treeview selection by mouse

Posted on 2006-10-30
2
340 Views
Last Modified: 2008-03-17
When I Click on a treeview I only want a treenode selected if the node was clicked on it's Icon, it's Label, or the plus/minus symbol.

 All Those situations work, however when the treeview is clicked in a Blank Area, the treenode that is on the same Y-axis as where the mouse was clicked becomes the selected node.  How can I prevent that from happening and only have the treenode be the selected node when the Icon, Plus/minus, or label is selected??

0
Comment
Question by:OFGemini
2 Comments
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 125 total points
ID: 17836830
I don't suppose setting FullRowSelect = False on the TreeView does it?  It's been a while since I've played extensively with a TreeView in .NET.

If not, you might try using the GetNodeAt() method to find the node at the point where the user clicked, though I'm guessing that would return a node for any locations that also result in selecting that node, so it wouldn't really gain you anything.
0
 

Author Comment

by:OFGemini
ID: 17837722
You're are right VoteyDisciple.  GetNodeAt() does exactly what I DO NOT want it to do.    

I made a change to my code and when I left click on the treeview it behaves as I want it to, but getNodeAt() does not.  I use getNodeAt to make a node the selected node if it is Right-Clicked.  I did that in my treeview mousedown event.  

Now I need to figure out how to Get the right click working correctly.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now