Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to change font for node's tooltip (Read 2297 times)
Ada
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Mar 13th, 2014
How to change font for node's tooltip
Mar 28th, 2014 at 12:12am
Print Post  
I want to show some tool-tip with lined up format, so I need to set the font to some fixed width font, for example: Courier New.
I changed font for node, diagram, diagramview, form, but the tool tip's font is still the old one, how can change it?

Thanks.

Ada
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to change font for node's tooltip
Reply #1 - Mar 28th, 2014 at 6:54am
Print Post  
The only way I could find to implement that in Windows Forms is via custom drawing:

Code
Select All
diagramView.ShowToolTips = true;
diagramView.ToolTipControl.OwnerDraw = true;
diagramView.ToolTipControl.Draw += (s, args) =>
{
	var font = new Font("Courier New", 20);
	args.Graphics.FillRectangle(
		Brushes.White, args.Bounds);
	args.Graphics.DrawString(
		args.ToolTipText, font, Brushes.Black, 0, 0);
	font.Dispose();
};
diagramView.ToolTipControl.Popup += (s, args) =>
{
	var font = new Font("Courier New", 20);
	args.ToolTipSize = TextRenderer.MeasureText(
		diagramView.ToolTipControl.GetToolTip(diagramView), font);
	font.Dispose();
}; 



You will have to take care of drawing the tooltip shape too: balloon, rectangle, or whatever you need.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Ada
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Mar 13th, 2014
Re: How to change font for node's tooltip
Reply #2 - Apr 7th, 2014 at 9:17pm
Print Post  
Thanks Stoyan ,

It works, now the tooltip looks much better.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint