I am new to this. The code below is what I have in my usercontrol, but when I insert it into an .aspx page the image takes over the whole page and removes other existing controls. How can I display the image including the graphics(g) within the div designated to the usercontrol in the .aspx page, without it removing all the other controls? Thanks
DisplayImage.aspx (User Control)
Bitmap BitMapImage= new System.Drawing.Bitmap(Server.MapPath("image1.Png"));
Graphics g= Graphics.FromImage(BitMapImage);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.DrawString( "GREAT", new Font("Calibri", 18,FontStyle.Bold ), SystemBrushes.WindowText, new Point( 175, 300 ) );
Response.ContentType="image/Png";
BitMapImage.Save(Response.OutputStream, ImageFormat.Png);
You need to request the image as a separate URL. You reference the image URL from the HTML generated by your aspx page, but the image itself is generated in response to a different HTTP request.