DesignTime not working

S

Spacca

I'm developing a WebControl to display a button with an image... it is an
initial developing, my problem
is that i cant see it at design time...

here is my little code... :

i know that the problem is on HttpContext witch is null at design time....
any suggestion ?

protected override void Render( HtmlTextWriter writer)

{

System.Drawing.Image Img=
System.Drawing.Image.FromFile("c:\\0\\indice.jpg");

Graphics g=Graphics.FromImage (Img);

Pen p= new Pen (Color.Blue);

g.DrawLine (p,0,0,10,10);

System.Web.HttpContext http=System.Web.HttpContext.Current;

http.Response.Clear();

http.Response.ContentType="image/JPEG";

Img.Save(http.Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg);

g.Dispose();

Img.Dispose();

http.Response.End();

}
 
V

Victor Garcia Aprea [MVP]

Hi Spacca,

Take a look at the ControlDesigner class. You can create a custom designer
and associate it with your control so you can offer a rich design-time
experience rendering an specialized output just for design-time (i.e.
without using context, etc).

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,121
Messages
2,570,712
Members
47,283
Latest member
hopkins1988

Latest Threads

Top