My code to display tooltip on mousehover is as follows
开发者_Python百科 e.Node.ToolTipText = Convert.ToString(sb);
But this is displaying with the default color yellow. Can i change this to some other color. I did not find any property for that . If possible can any one give me an idea...
Thanks & Regards, M.Dorababu.
The background color for a tool tip is a system color setting, you cannot reasonably change that setting. You can alter the appearance yourself by setting the ToolTip.DrawMode property. A good example of the Draw event handler you'll need is in the MSDN library topic for that event.
The next obstacle is definitely the harder one. The tooltip control that displays tips for nodes is built into the native Windows control, you cannot replace it. You'll have to give up on the TreeNode.ToolTipText property and store it elsewhere. Like the Tag property, or generate it on-the-fly.
Then you need to wire into the TreeView's MouseMove event and use its HitTest() method to find out where the mouse is located. Toggle a Timer's Enabled property when the mouse is moved. Use the Tick event to call the ToolTip.Show() method. And wire MouseLeave to turn everything off.
Quite possible, falls in the "when there's a will, there's a way" category.
There is no standard property for that. And for good reason: The colour of the tooltip is none of your business, it’s up to the user. If you really want to work against established practices and reduce the quality of your software for no reason other than to be different, then you’ll have to create your own tooltip component. Otherwise, you should stick with the default.
精彩评论