Click to See Complete Forum and Search --> : How can you set the position of a bitmap?


Mark1
June 29th, 2001, 09:02 AM
Hi,

I have a "continue" button attched to my scenery area for my game.

There is a main image : "Image1".

When I press the continue button, the scenery changes and the next set loads.

But, the "Image1" stays in the same position on the screen as in Scenery1. How can I set the position of this bitmap (in a picture box) to somewhere from my screen. If possible could I attach the code the main scenery image, rather than the continue button as well?

Thanks

Mark

Cimperiali
June 29th, 2001, 09:06 AM
picture1.move(picture1.left+picture1.width)
'or
picture1.left = picture1.left+picture1.width



'you can put this code in a timer event

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.

shree
June 29th, 2001, 09:11 AM
Yes, you can do so, but you'll have to use a temporary picturebox.
Load the image into the (invisible) temporary picture box and then use PaintPicture to place this image anywhere on your main picturebox.

For making the image clickable, there are two ways:

If it's a rectangular button then you can simply check the coordinates in the Picture1_MouseDown event.

If x > 10 and y > 10 and x < 100 and y < 50 then
Do something

This will be like clicking a rectangular hotspot defined by the rectangle (10,10)-(100,50)

If it's an ellipse or any other complicated area, then you have to use the APIs CreateEllipticRgn, CreatePolygonRgn to define the clickable area and then use PtInRegion to check whether the clicked point is within the hotspot.