We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





75907 Aug 14,2008 11:27 AM UTC Aug 18,2008 11:57 AM UTC WinForms 3
Tags: Diagram
Asked On August 14, 2008 11:27 AM UTC

How to change Font at TextNode which have arranged on the diagramme.
How to appoint keys Ctrl + '+' and Ctrl + '-' for scaling diagramm.
In advance thanks.

J.Nagarajan [Syncfusion]
Replied On August 14, 2008 12:53 PM UTC

Hi ,

1. Change Font of TextNode:

You can use FontStyle property of the TextNode and you can change the font at run time. Please refer to the below code snippet.

Syncfusion.Windows.Forms.Diagram.TextNode txtnode = new TextNode( "SIMPLE FLOW DIAGRAM" );
txtnode.FontStyle.Size = 20;
txtnode.FontStyle.Italic = true;
txtnode.FontStyle.Bold = true;
txtnode.FontStyle.Family = "Cambria";
txtnode.FontColorStyle.Color = Color.Purple;
txtnode.LineStyle.LineColor = Color.Transparent;
txtnode.PinPoint = new PointF(250, 30);

2. To appoint keys Ctrl + '+' and Ctrl + '-' for scaling diagram:

For scaling the diagram, you have to derive the ZoomTool and override the ProcessMouseUp() method. To catch the Ctrl + '+' and Ctrl+ '-' key, you have to override ProcessCmdKey() method. Please refer to the below code snippet.

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
if (diagram1.ContainsFocus)

if (((keyData & Keys.Control) == Keys.Control) && ((keyData & Keys.Oemplus) == Keys.Oemplus))
zoomTool = new CustomZoomTool(this.diagram1.Controller);
zoomTool.SingleActionTool = false;
zoomTool.ProcessMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 1));
if (((keyData & Keys.Control) == Keys.Control) && ((keyData & Keys.OemMinus) == Keys.OemMinus))
if (zoomTool != null)
zoomTool.ProcessMouseUp(new MouseEventArgs(MouseButtons.Right, 0, 0, 1, 1));

return base.ProcessCmdKey(ref msg, keyData);

Here is the working sample.


Please refer to it and let me know if this helps.


Replied On August 15, 2008 05:58 AM UTC

Thanks for the answer. And if I create TextNode in separate class TextField. How to address to it for font change.
In advance thanks.

J.Nagarajan [Syncfusion]
Replied On August 18, 2008 11:57 AM UTC

Hi ,

You can derive a TextNode in a separate class and you can set the font to that TextNode. Please refer to the below code snippet.

class TextField:TextNode
public TextField(string Text):base(Text)
this.FontStyle.Size = 20;
this.FontStyle.Italic = true;
this.FontStyle.Bold = true;
this.FontStyle.Family = "Cambria";
this.FontColorStyle.Color = Color.Purple;
this.LineStyle.LineColor = Color.Transparent;
this.PinPoint = new PointF(250, 30);

//To Add TextField to the Diagram Model

TextField m_txtField = new TextField("SIMPLE FLOW DIAGRAM");

Please refer to the attached sample for more details.


Please let me know if this helps.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon