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. Image for the cookie policy date

Setting Image as a background

I want to know whether I can set the .jpg file as a background for DiagramWebControl. Thanks Swati

1 Reply

AD Administrator Syncfusion Team April 6, 2005 04:03 PM UTC

Hi Swati, 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, // The Web Forms Page.Load event handler 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; } } Prakash Surendra Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon