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.

Can I set an image as the background for the Diagram Web Control?

 

Yes, it is possible to set an image as the background for the DiagramWebControl. The DiagramWebControl shares its architecture with the Windows Forms version of the product, and most of the functionality available in the Windows version of Essential Diagram is available in the Web Control as well.

The following code shows how to set a background image for the Diagram Web Control,

C#

private void Page_Load(object sender, System.EventArgs e)

{

if(this.IsPostBack == false)

{

// To Set a background image for the DiagramWebControl...

// First create a Bitmap object for the background image

string path = Server.MapPath("/syncfusion/");

path = path + @"\Web\Diagram.Web\Samples\ScriptyClient\CS\bin\suiteimage.jpg";

System.Drawing.Bitmap background = new Bitmap(path);

// Now assign the image to the diagram model's BackgroundStyle property

this.DiagramWebControl1.Model.BackgroundStyle.Type = BackgroundStyle.BackgroundType.Texture;

this.DiagramWebControl1.Model.BackgroundStyle.TextureWrapMode = System.Drawing.Drawing2D.WrapMode.Tile;

this.DiagramWebControl1.Model.BackgroundStyle.Texture = background;

}

}

VB

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Me.IsPostBack = False Then

' Create a Bitmap object for the background image

Dim path As String = Server.MapPath("/syncfusion/")

path = path + "\Web\Diagram.Web\Samples\ScriptyClient\CS\bin\suiteimage.jpg"

Dim background As System.Drawing.Bitmap = New Bitmap(path)

' Assign the image to the diagram model's BackgroundStyle property

Me.DiagramWebControl1.Model.BackgroundStyle.Type = BackgroundStyle.BackgroundType.Texture

Me.DiagramWebControl1.Model.BackgroundStyle.TextureWrapMode = System.Drawing.Drawing2D.WrapMode.Tile

Me.DiagramWebControl1.Model.BackgroundStyle.Texture = background

End If

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
188 04/30/2011 07/10/2014 ASP.NET Web Forms (Classic) DiagramWebControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.