Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running events of parts of an image.

Status
Not open for further replies.

PANTLORD

Programmer
Aug 28, 2001
49
0
0
EU
Hi there,

I am just interested in the possibility of running different events based on whichever part of a bitmap the user clicks does anyone know if this is possible?

I was thinking that probably some kind of grid reference scheme would need to be used.

Any ideas any siilar projects I'd be very grateful to hear.

Thanks
PL
 
Instead of using the onClick method use the mouse down, this has as 2 of its param the X and Y co-ords of the click.

You could build conditions around these to control the actions:

EG

Code:
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  caption := 'X='+ intToStr(x)+
             ' Y='+intToStr(y);
end;

X-) Billy H

bhogar@acxiom.co.uk
 
Thanks for that,

I was delving a little more into the Delphi component library though and was thinking that I could just overlay Bitmap buttons on an image and run events off the on click procedure. As I have a limited number of combinations I can probably just design them all and make them visible when needed.

What do you think?

Thanks
PL
 
Hi PL
You may have a problem with bit buttons as there is no simple way to make the button itself transparent.
You could use Speed buttons these have a 'Flat' property set this True and the background will appear transparent but you will see the outline of the buuton when it is pressed.

In both cases you can only easily put a bitmap (.bmp) on the button which can be retrictive as you don't have the flexibility of Icons (.ico).

Alternativly, you could setup small TImage's and put an Icon on them which you can overlay on your larger image, these have an onclick event.

Steve

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top