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

Drawing rectangle on Diagram

Thread ID:





64323 Jul 18,2007 12:45 PM UTC Jul 18,2007 03:34 PM UTC WinForms 1
Tags: Diagram
Faheem Rauf
Asked On July 18, 2007 12:45 PM UTC

Hi, I am using Version I am trying to draw rectangles on the diagram. I am using following code please guide me how can I achieve this functionality.

Graphics g = this.diagram1.CreateGraphics();
g.DrawRectangle(new Pen(Color.Red), 0, 0, 100, 100);




J.Nagarajan [Syncfusion]
Replied On July 18, 2007 03:34 PM UTC

Hi Fahim,

If your intention is to draw rectangle on the diagram then you have to use the following code snippet

Syncfusion.Windows.Forms.Diagram.Rectangle nodeRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(50, 100, 125, 75);
nodeRect.FillStyle.Color = Color.FromArgb(255, 223, 189);
nodeRect.LineStyle.LineColor = Color.Orange;
Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(nodeRect,"Rectangle");
lbl.FontStyle.Size = 12;
lbl.FontStyle.Bold = true;

I have attached the sample that demonstrates this completely. You can download the sample from the following page.


Please refer to the sample and let me know if you have any questions.



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

or the page will be automatically redirected to 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