|
-
June 29th, 2001, 09:02 AM
#1
How can you set the position of a bitmap?
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
-
June 29th, 2001, 09:06 AM
#2
Re: How can you set the position of a bitmap?
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.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
June 29th, 2001, 09:11 AM
#3
Re: How can you set the position of a bitmap?
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|