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

Layer with a background image

Thread ID:

Created:

Updated:

Platform:

Replies:

105393 Oct 9,2012 02:34 AM Nov 2,2012 07:26 AM Windows Forms 3
loading
Tags: Diagram
Domenico Mozzone
Asked On October 9, 2012 02:34 AM

Dear Support,
I'm using Essential Studio Version 10.3.0.43.
I have the request to add a layer to a diagram with a background image that the final user can use as a guide to draw diagrams.Till now I found out the way to add a background image to the diagram.Model object, but this not completely fulfill the request.
So the need is to 
1. add a layer to existing diagram
2. put that layer in the last position in depth of zorder
3. add an image to it programatically stretching it to fit the diagram page dimension
It it possible? 
Thank you

Best Regards
Domenico Mozzone



Amsath Ali M [Syncfusion]
Replied On October 18, 2012 07:16 AM

Hi Domenico,

 

Thanks for your interest in Syncfusion products.

 

Currently there is no option to add background image to a layer. However, you can use the bitmap node and set the height and width of the bitmap node to height and width of model in order to look like as a background image of that layer. Please refer the below code snippet to make a bitmap node look like as a background image of Layer.

 

Here is the code:

[C#]

Bitmap bmpBackgrnd = new Bitmap(@"..//..//main_floor_plan.jpg");

            BitmapNode bmpNode = new BitmapNode(bmpBackgrnd, new RectangleF(0, 0, diagram1.Model.DocumentSize.Width, diagram1.Model.DocumentSize.Height));

            bmpNode.PinPointOffset = new SizeF(0, 0);

            bmpNode.PinPoint = new PointF(0, 0);

            bmpNode.EditStyle.AllowSelect = false;

            diagram1.Model.AppendChild(bmpNode);

            lyr.Add(bmpNode);

 

Here is the sample:

http://files2.syncfusion.com/dtSupport/DirectTrac/99568/F105393-1867219536.zip

 

Please let us know if you have any queries.

 

Regards,

Amsath Ali. M



F105393_9fcfca2f.zip

Amsath Ali M [Syncfusion]
Replied On November 1, 2012 02:29 AM

Hi Domenico,

 

Thanks for your interest in Syncfusion products.

 

Currently there is no option to add background image to a layer. However, you can use the bitmap node and set the height and width of the bitmap node to height and width of model in order to look like as a background image of that layer. Please refer the below code snippet to make a bitmap node look like as a background image of Layer.

 

Here is the code:

[C#]

Bitmap bmpBackgrnd = new Bitmap(@"..//..//main_floor_plan.jpg");

            BitmapNode bmpNode = new BitmapNode(bmpBackgrnd, new RectangleF(0, 0, diagram1.Model.DocumentSize.Width, diagram1.Model.DocumentSize.Height));

            bmpNode.PinPointOffset = new SizeF(0, 0);

            bmpNode.PinPoint = new PointF(0, 0);

            bmpNode.EditStyle.AllowSelect = false;

            diagram1.Model.AppendChild(bmpNode);

            lyr.Add(bmpNode);

 

Here is the sample:

http://files2.syncfusion.com/dtSupport/DirectTrac/99568/F105393-1867219536.zip

 

Please let us know if you have any queries.

 

Regards,

Amsath Ali. M


Domenico Mozzone
Replied On November 2, 2012 07:26 AM

Thank you for your help and for the example.
Kind regards
Domenico M.

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

;