views:

26

answers:

1

I am using a 3rd party library for some GDI+ drawing capabilities where the method to actually implement the drawing takes a Graphics object and a Rectangle object as parameters. In the Paint event of my WinForms application I can then execute:

externalLibrary.Draw(e.Graphics, ClientRectangle);

When implementing the same thing in ASP.NET I can create a new Graphics object but is there an equivalent of ClientRectangle for a Page or WebUserControl?

+1  A: 

Drawing in ASP.NET is different than drawing in a Windows Forms application.The ClientRectangle is a property used in Windows Forms applications, and not in ASP.NET applications.

Drawing in ASP.NET is a two step procedure: you have to use the GDI+, or any library that uses GDI+, and dynamically generate an image (through, for example, an .aspx file).

Then you can link that image, using a HTML < img > tag, in an .aspx file (the place that will render your drawing).

The dimensions of the generated image, play the role of the ClientRectangle property, like when drawing in a Windows Forms application.

ileon