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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drawing rectangle on Diagram

Thread ID:

Created:

Updated:

Platform:

Replies:

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

Hi, I am using Version 5.1.0.51. 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);

or

g.DrawImage()

regards,

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;
nodeRect.Labels.Add(lbl);
this.DiagramWebControl1.Model.AppendChild(nodeRect);

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

http://websamples.syncfusion.com/samples/Diagram.Windows/F64323/main.htm

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

Thanks,
Nagaraj

CONFIRMATION

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.

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

;