tags:

views:

128

answers:

2

Hi all!

I'm trying to draw few images on top of one image (using GDI+)- which if you do it all at once is not a problem, but I want the images to appear one at a time-

for the example here: there is one image on the top of the webPage at all times- a house picture, when you click on one of the buttons- a flower is added on the house image (it's a png so the background is transparent) when you click on a different button - a tree is added on the house image etc... but if you click on a different flower button the first flower will dissappear and you will see only the new flower (but you will still see the other stuff you added- like trees and people...)

I used the following code:

Response.ContentType=("image/jpeg");
objHouse = new Bitmap(housePath);
g = Graphics.FromImage(objHouse );

to view the house and a method:

Bitmap flower1= new Bitmap(imagePath);
g.DrawImage(flower1, new Point(10, 50));
objHouse .Save(Response.OutputStream, ImageFormat.Jpeg);

when I use the same graphics object g. it keeps refreshing and I cannot seem to manage to draw more than one picture on top of the house at a time (and the buttons keep disapeering)

I could really use some Help! Thanks!!!

A: 

I think because you say contenttype = image, the browser expects 1 binary image.
When You have said objHouse.Save, one image has been written..

When you want to return multiple images in one page you need to return HTML with multiple image tags.

<img src="house1"/><br>
<img src="house2"/><br>
<img src="house3"/><br>


Within this html 3 requests will be done to get the images..
Now you have to generate the desired image on a per-request basis.

Julian de Wit
A: 

thanks for your responds,

i don't understand it fully, but do you mean that I will delete the line about contentType and will add to the aspx more tags of the house? but I only have one source of the house and I refer it to Sample1.aspx, should I add the other 2 img sources to the same source?