473,563 Members | 2,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView Question

Hi,

I want to display a 'hover box' (for want of a better description) when

the mouse hovers over a node in a tree view. The box would display
detail information for the node. It should be small, something like a
tool tip.
Does anyone have any idea of how to do this? I would really appreciate
any assistance, especially a code snippet or two.
Thanks!
~ Si

Jun 25 '06 #1
3 5307
Handle the NodeMouseHover event of the TreeView. It contains arguments that
indicate which node is being hovered over. Then all you have to do is
implement a ToolTip (or rool your own), and display it wherever you want to,
in whatever way you want to.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
"sianan" <sm*********@td s.net> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
Hi,

I want to display a 'hover box' (for want of a better description) when

the mouse hovers over a node in a tree view. The box would display
detail information for the node. It should be small, something like a
tool tip.
Does anyone have any idea of how to do this? I would really appreciate
any assistance, especially a code snippet or two.
Thanks!
~ Si

Jun 25 '06 #2
Thanks Kevin,

I still can't make it work though. Not sure how I should implement the
ToolTip and associate it with the selected node. Here's what I've got:

private void myTreeView_Node MouseHover(obje ct sender,
TreeNodeMouseHo verEventArgs e)
{
e.Node.ToolTipT ext = "descriptio n";

}

Something is obviously missing (just can't figure it out).

Thanks!

Kevin Spencer wrote:
Handle the NodeMouseHover event of the TreeView. It contains arguments that
indicate which node is being hovered over. Then all you have to do is
implement a ToolTip (or rool your own), and display it wherever you want to,
in whatever way you want to.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
"sianan" <sm*********@td s.net> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
Hi,

I want to display a 'hover box' (for want of a better description) when

the mouse hovers over a node in a tree view. The box would display
detail information for the node. It should be small, something like a
tool tip.
Does anyone have any idea of how to do this? I would really appreciate
any assistance, especially a code snippet or two.
Thanks!
~ Si


Jun 28 '06 #3
Hi sianan,

If you set the TreeView's ShowNodeToolTip s property to true, you don't even
have to handle the OnMouseOver event if you only want to display a ToolTip
on a TreeNode when the mouse hovers over it. Just set the node's ToolTipText
property. However, if you want to dynamically assign the ToolTipText when
the Mouse hovers over the TreeNode, this will be much more difficult. The
ToolTip will pop up before the event is fired, and the text assigned will be
the text that was assigned prior to the event.

Now, I haven't tested this, but I believe it would be possible to handle the
TreeView.MouseM ove event to do this. The trick is getting the TreeNode that
the mouse is over. This is done using the TreeView.HitTes t method. When the
MouseMove event fires, it passes a MouseEventArgs argument to the event
handler. This contains the XY coordinates of the mouse relative to the
Control. You can take the X and Y values and pass them to the
TreeView.HitTes t method, which returns a TreeViewHitTest Info instance that
contains the TreeNode that the mouse is over (if any). You can use this to
get a handle on the TreeNode and assign the ToolTipText prior to the
MouseHover event, which happens only when the moust *stops* moving over a
Control for a period of several milliseconds. Then, assuming you've turned
on the ShowNodeToolTip s property, you shouldn't have to handle any other
events.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
"sianan" <sm*********@td s.net> wrote in message
news:11******** **************@ d56g2000cwd.goo glegroups.com.. .
Thanks Kevin,

I still can't make it work though. Not sure how I should implement the
ToolTip and associate it with the selected node. Here's what I've got:

private void myTreeView_Node MouseHover(obje ct sender,
TreeNodeMouseHo verEventArgs e)
{
e.Node.ToolTipT ext = "descriptio n";

}

Something is obviously missing (just can't figure it out).

Thanks!

Kevin Spencer wrote:
Handle the NodeMouseHover event of the TreeView. It contains arguments
that
indicate which node is being hovered over. Then all you have to do is
implement a ToolTip (or rool your own), and display it wherever you want
to,
in whatever way you want to.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
"sianan" <sm*********@td s.net> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
> Hi,
>
> I want to display a 'hover box' (for want of a better description) when
>
> the mouse hovers over a node in a tree view. The box would display
> detail information for the node. It should be small, something like a
> tool tip.
>
>
> Does anyone have any idea of how to do this? I would really appreciate
> any assistance, especially a code snippet or two.
>
>
> Thanks!
>
>
> ~ Si
>

Jun 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2419
by: Sonia Igla | last post by:
Hi. I need to perform DBLCLK on TreeView Node. I try the following: private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam, UInt32 lParam); private const UInt32 WM_LBUTTONDBLCLK = 0x203; pTreeNode.TreeView.SelectedNode = pTreeNode;
3
2151
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
3
441
by: Michael C | last post by:
Hi all, Quick question about the TreeView control. I'm using code like this to determine the currently clicked TreeNode in the TreeView. private void MyTreeView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { currentNode = MyTreeView.GetNodeAt(e.X, e.Y); }
3
1800
by: Tom | last post by:
Sorry... new to this. I trying to figure out how to do a page redirect when someone clicks a treeview node. Does someone have a code snippet for this?
3
11214
by: Gerhard | last post by:
I have the following code in an .net 2.0 project: <asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation" Width="165px"> <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None" CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False"> <LevelStyles>...
1
2128
by: Sam | last post by:
Hi, On my main form in my MDI application, I have two treeview, one on the right, which is actually a UserControl inherited from Treeview, and the other on the left. When I click on a node in the left Treeview, all the nodes in BOTH Treeview disappear for some milliseconds. First question: Why do I get this nasty effect? Second...
1
2421
by: Daves | last post by:
Sorry folks but I will be reposting this question from 6/5 until someone gives me an answer - the question is very easy and so ought the answer to be. I really need the answer! ------- I'm sorry for reposting but I've already googled for hours and I see others have asked about this here without getting replies, this is starting to look...
8
12742
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if...
7
7826
by: Joe Cool | last post by:
Let's say I have a Treeview control on a form. Each leaf node in the Treeview has a ContextMenuStrip, each with one ToolStripMenuItem, and all ToolStripMenuItems Click event is handled by a comment event handler. How do I determine which Treeview Node signalled the menu event in the common event handler?
9
6120
by: auntiejack56 | last post by:
Hi, I've got a treeview, and I want to display the node text property that I have a) clicked on or b) highlighted using the up or down arrows
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.