这个我原来做过, procedure TMainForm.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if (x>118) and (X<218) and (y<400) and (y>292) then begin speedbutton1.Visible:=true; end else if (x>128) and (X<228) and (y<156) and (y>56) then begin speedbutton5.Visible:=true; end else if (x>312) and (X<412) and (y<156) and (y>56) then begin speedbutton6.Visible:=true; end else if (x>304) and (X<404) and (y<400) and (y>292) then begin speedbutton4.Visible:=true; end else if (x>60) and (X<160) and (y<276) and (y>176) then begin speedbutton2.Visible:=true; end else if (x>368) and (X<468) and (y<276) and (y>176) then begin speedbutton3.Visible:=true; end else if (x>450) and (X<520) and (y<385) and (y>344) then begin image2.Visible:=true;
end else begin speedbutton1.Visible:=false; speedbutton2.Visible:=false; speedbutton3.Visible:=false; speedbutton4.Visible:=false; speedbutton5.Visible:=false; speedbutton6.Visible:=false; image2.visible:=false; end;end;
interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
FRgn :HRGN;
pt :array [0..3] of TPoint;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
begin
pt[0] :=Point(50,100);
pt[1] :=Point(100,50);
pt[2] :=Point(150,100);
pt[3] :=Point(100,150);
Image1.Canvas.Polygon(pt);
FRgn :=CreatePolygonRgn(pt,4,Winding);
end;procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if PtInRegion(FRgn,x,y) then
showmessage('点在这区域中');
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
DeleteObject(FRgn);
end;end.
pt: point;
begin
getcursorpos(pt);
if (pt.x=???) and (pt.y=???) then
showmessage('yes')
else
showmessage('no')
end;
procedure TMainForm.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if (x>118) and (X<218) and (y<400) and (y>292)
then
begin speedbutton1.Visible:=true; end
else
if (x>128) and (X<228) and (y<156) and (y>56) then
begin
speedbutton5.Visible:=true; end
else
if (x>312) and (X<412) and (y<156) and (y>56)
then
begin
speedbutton6.Visible:=true; end
else
if (x>304) and (X<404) and (y<400) and (y>292) then
begin
speedbutton4.Visible:=true; end
else
if (x>60) and (X<160) and (y<276) and (y>176) then
begin
speedbutton2.Visible:=true; end
else if (x>368) and (X<468) and (y<276) and (y>176) then
begin
speedbutton3.Visible:=true; end
else if (x>450) and (X<520) and (y<385) and (y>344) then
begin
image2.Visible:=true;
end
else
begin
speedbutton1.Visible:=false;
speedbutton2.Visible:=false;
speedbutton3.Visible:=false;
speedbutton4.Visible:=false;
speedbutton5.Visible:=false;
speedbutton6.Visible:=false;
image2.visible:=false;
end;end;