[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

how to make drawimage work in WEB FORM??

(Dazhi yang)

1/16/2003 8:11:00 PM

hi all, i'm stuggling to make drawimage method work in web forms. i've
used it in windows form and it worked fine. but in web form, first of
all i don't have the paintEventArg, so what i did is i created a grafics
obj and called it objGraphics (created from imagefile). but the
drawimage wouldn't do anything until i added

bike.Save(Response.OutputStream, ImageFormat.Jpeg);
big.Save(Response.OutputStream, ImageFormat.Jpeg);

(bike and big are my image obj names)
but then the image is displayed ON TOP OF my other web controls, i took
the line of drawimage out and found the image is still being displayed.
so can someone explain me how drawimage works for WEB forms? and how can
i make it to draw an image at certain position on a webpage?

thanks!


*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!
3 Answers

Jesse Ezell

1/20/2003 6:22:00 PM

0

You cannot use this function inside a web form. You need
to create a custom page that only outputs image data.
Then, you make requests to this page to get your images
by putting the url of the page with any parameters in the
SRC attribute of an image tag.

--Jesse

>-----Original Message-----
>hi all, i'm stuggling to make drawimage method work in
web forms. i've
>used it in windows form and it worked fine. but in web
form, first of
>all i don't have the paintEventArg, so what i did is i
created a grafics
>obj and called it objGraphics (created from imagefile).
but the
>drawimage wouldn't do anything until i added
>
>bike.Save(Response.OutputStream, ImageFormat.Jpeg);
>big.Save(Response.OutputStream, ImageFormat.Jpeg);
>
>(bike and big are my image obj names)
>but then the image is displayed ON TOP OF my other web
controls, i took
>the line of drawimage out and found the image is still
being displayed.
>so can someone explain me how drawimage works for WEB
forms? and how can
>i make it to draw an image at certain position on a
webpage?
>
>thanks!
>
>
>*** Sent via Developersdex http://www.develop...
***
>Don't just participate in USENET...get rewarded for it!
>.
>

(Scott Mitchell [MVP])

1/21/2003 10:10:00 PM

0

You've got to use two ASP.NET Web pages. One that draws the image and
one that displays it. So, you have it so it can draw an image, great,
put this in an ASP.NET Web page named DrawImage.aspx. So you might
have:

DrawImage.aspx:
---------------
<script language="C#" runat="server">
void Page_Load(object sender, EventArgs e)
{
Response.ContentType="image/jpeg";
... do image drawing ...
bike.Save(Response.OutputStream, ImageFormat.Jpeg);
}
</script>


And that's all that's in there! Just ONE image for this page. Then,
in the page where you want it to appear, you can simply add:

<img src="DrawImage.aspx" />

Wherever you want the image to appear...

hth



Dazhi Yang <gt9988b@yahoo.com> wrote in message news:<ud$xbMZvCHA.2296@TK2MSFTNGP09>...
> hi all, i'm stuggling to make drawimage method work in web forms. i've
> used it in windows form and it worked fine. but in web form, first of
> all i don't have the paintEventArg, so what i did is i created a grafics
> obj and called it objGraphics (created from imagefile). but the
> drawimage wouldn't do anything until i added
>
> bike.Save(Response.OutputStream, ImageFormat.Jpeg);
> big.Save(Response.OutputStream, ImageFormat.Jpeg);
>
> (bike and big are my image obj names)
> but then the image is displayed ON TOP OF my other web controls, i took
> the line of drawimage out and found the image is still being displayed.
> so can someone explain me how drawimage works for WEB forms? and how can
> i make it to draw an image at certain position on a webpage?
>
> thanks!
>
>
> *** Sent via Developersdex http://www.develop... ***
> Don't just participate in USENET...get rewarded for it!

(Scott Mitchell [MVP])

1/21/2003 10:11:00 PM

0

To see an example of creating a Web page that displays an image, and
then using an <img> tag to display the image produced by the ASP.NET
Web page, see:
http://aspnet.4guysfromrolla.com/articles/012...

Happy Programming!