Click here to Skip to main content
15,888,270 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,


I've been trying to implement a custom OwnerDraw ToolTip that will
display when the mouse is hovering over a TreeNode. So far I have the
ToolTip coming up and drawing properly through my custom ToolTip.Draw
Handler, but the tool tip tip image is showned after the mouse leave on the node..

i need to appear the tool tip when the mouse is hover on the node,not after leaving the node ..

Any one pls help me

Thanks in advance...
here is my code


private void trvObjects_NodeMouseHover(object sender, TreeNodeMouseHoverEventArgs e)
{
CustomizedToolTip myToolTip1 = new CustomizedToolTip();
myToolTip1.SetToolTip(this.treview1, "test");
}
<b>
CustomizedToolTip.cs custom control code </b>
void CustomizedToolTip_Draw(object sender, DrawToolTipEventArgs e)
{
//if (object.ReferenceEquals(e.AssociatedControl, ))
//{
// // Draw the custom background.
using (System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.AntiqueWhite, Color.CornflowerBlue, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal))
{
e.Graphics.FillRectangle(brush, e.Bounds);
}
//Draw the border (default).
e.DrawBorder();
//Image _img = Image.FromFile(_imgfilename);
Bitmap image = new Bitmap(&amp;quot;D:\\test.jpg&amp;quot;);
e.Graphics.DrawImage(image, 0, 0, 256, 256);
// }
}
void CustomizedToolTip_Popup(object sender, PopupEventArgs e)
{
// if (object.ReferenceEquals(e.AssociatedControl, myctr))
// {
e.ToolTipSize = new Size(256, 256);
// }
}
Posted
Updated 8-Aug-11 22:53pm
v4
Comments
[no name] 9-Aug-11 3:51am    
Post your code here, no one can help you without seeing your code.
rajesh.r4321 9-Aug-11 4:46am    
i add my solution pls look on it
BillWoodruff 9-Aug-11 21:14pm    
Can't tell from looking at the code posted what is really going on. A standard WinForm TreeView 'MouseHover handler will have an 'EventArgs argument, not 'TreeNodeMouseHoverEventArgs. So, to me, that means you are using a custom TreeView, or a TreeView you've sub-classed off the WinForms TreeView ... are you ?

Second, your 'NodeMouseHover event handler is not doing anything with the 'TreeNodeMouseHoverEventArgs e argument that we can see in the code shown here.

Please clarify. best, Bill

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900