Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Re: Using System.Drawing, System.Drawing2D and System.Imaging in web pages


Message #1 by "Tomasz Szypilo" <Tomasz.Szypilo@c...> on Tue, 11 Feb 2003 22:10:17
Hi !

I have this:

First Create Bitmap:

        Dim objRectange As New Rectangle(0, 0, 220, 130)
        Dim objBox As New Rectangle(10, 10, 200, 110)

        Dim objBitmap As Bitmap = New Bitmap(objRectange.Width, 
objRectange.Height)

        Dim objGraphics As Graphics = Graphics.FromImage(objBitmap)

        Dim objBrush As New SolidBrush(Color.FromArgb(245, 245, 245))
        objGraphics.FillRectangle(objBrush, objRectange)

        objGraphics.DrawLine(New Pen(Color.Black), 10, 10, 10, 121)
...
Next, save to a file:

        Dim strPath As String = "c:\temp\picture.Wmf"
        objBitmap.Save(strPath, System.Drawing.Imaging.ImageFormat.Wmf)

        objGraphics.Dispose()
        objBitmap.Dispose()
        objRectange = Nothing
        objBox = Nothing

Finally, open from file:

Image1.ImageUrl = strPath

(all with Namespace System.Drawing)

I'm trying save this bitmap to a stream: objBitmp.Save
(Response.OutputStream, System... but without result).

Any idea ?

Tomasz

> Try this :
> 
> Create an empty bitmap.
> 
> In your page, load it in a new graphics and paint on it what you want.
> Then, save it with another name (using Session.SessionID ?)
> Next, add an Image in your page with the URL of your new picture.
> 
> I think it work but :
>     be carefull about the name of the picture.
>     I don't know when deleting old Pictures.
> 
> I'll be interested with your code if this method is successfull (I do'nt
> have time actually to test it)
> 
> Richard Clark - rc@c...
> ______________________________________________
> NOUVEAU : Liste de diffusion sur MS.NET
> Inscription en envoyant un mail à :
> ----------------------------------------------
>    dotnetfrance-subscribe@y...
> ----------------------------------------------
> http://www.c2i.fr - Le portail francophone
> Visual Basic,VB.NET,ASP, ASP.NET
> + de 517 aides disponibles (15/02)
> ______________________________________________
> 
> 
> 
> ----- Original Message -----
> From: "Wim Hollebrandse" <Wim.Hollebrandse@c...>
> To: "ASP+" <aspx@p...>
> Sent: Friday, July 13, 2001 1:28 PM
> Subject: [aspx] Using System.Drawing, System.Drawing2D and 
System.Imaging in
> web pages
> 
> 
> > These namespaces only seem to contain methods which can be used in 
Windows
> > Forms. All examples (in C#) use EventArguments from the OnPaint event. 
Is
> > there any way of using these methods to create 'on-the-fly' images in 
an
> > HTML page?
> >
> > Cheers,
> > Wim
> >
> >
> 

  Return to Index