In a new page, suppress all the HTML code and add the following code or its
C# counterpart in Page.Load :
Dim b As New System.Drawing.Bitmap(100, 100,
System.Drawing.Imaging.PixelFormat.Format16bppRgb5 65)
Dim g As System.drawing.Graphics = System.Drawing.Graphics.FromImage(b)
Dim f As New System.Drawing.Font("Arial", 10)
g.FillRectangle(System.Drawing.Brushes.Bisque, 0, 0, 100, 100)
g.DrawString("Hello world !", f, System.Drawing.Brushes.Blue, 0, 0)
f.Dispose()
g.Dispose()
Response.ContentType = "image/jpeg"
b.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
b.Dispose()
You can now use this page wherver you want (for example as value for the src
attribute of an img tag) :
<img src="graphics.aspx">
You could add some parameter to control the image generation .
Hope it helps...
"Marc Pelletier" <ma**@goldak.stopspam.ca> a écrit dans le message de
news:Xn*********************@207.46.248.16...
"Patrice" <no****@nowhere.com> wrote in news:ulJy3h4JEHA.2680
@TK2MSFTNGP11.phx.gbl:
You stream the image to the browser by using the Save method using the
Response.OutputStream as an argument...
Yes, this is what I want to do, but how does it end up in my control? For
example, I have a datagrid and 2 images on my page, doesn't the response
object belong to the page? Maybe I'm dense but I need an actual example
that doesn't involve a page with nothing but an image on it.
Thanks
Marc Pelletier