Layer with a background image

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



3 Replies

AA Amsath Ali M Syncfusion Team October 18, 2012 11:16 AM UTC

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:

https://s3.amazonaws.com/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


AA Amsath Ali M Syncfusion Team November 1, 2012 06:29 AM UTC

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:

https://s3.amazonaws.com/files2.syncfusion.com/dtSupport/DirectTrac/99568/F105393-1867219536.zip

 

Please let us know if you have any queries.

 

Regards,

Amsath Ali. M



DM Domenico Mozzone November 2, 2012 11:26 AM UTC

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

Loader.
Up arrow icon