Код:
var
Form1: TForm1;
var move:boolean;
X0, Y0: Integer;
implementation
{$R *.dfm}
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button <> mbLeft then exit;
X0 := X;
Y0 := Y;
move := true;
(Sender as TControl).BringToFront;
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if move=true then begin with (Sender as TControl) do
SetBounds(Left + X - X0, Top + Y - Y0, Width, Height);
if (mouse.CursorPos.X>TabSheet1.Left+Pict1.Left)and
(mouse.CursorPos.X<TabSheet1.Left+Pict1.Left+image1.Width) and
(mouse.CursorPos.y>TabSheet1.top+Pict1.top) and
(mouse.CursorPos.y<TabSheet1.top+Pict1.top+Pict1.Height)
then Pict1.Picture.LoadFromFile('pic\text\1.png')
else
Pict1.Picture.LoadFromFile('pic\text\2.png');
if (mouse.CursorPos.X>TabSheet1.Left+Pict2.Left)and
(mouse.CursorPos.X<TabSheet1.Left+Pict2.Left+image1.Width) and
(mouse.CursorPos.y>TabSheet1.top+Pict2.top) and
(mouse.CursorPos.y<TabSheet1.top+Pict2.top+Pict2.Height)
then Pict2.Picture.LoadFromFile('pic\text\1.png')
else
Pict2.Picture.LoadFromFile('pic\text\2.png');
if (mouse.CursorPos.X>TabSheet1.Left+Pict2.Left)and
(mouse.CursorPos.X<TabSheet1.Left+Pict2.Left+image1.Width) and
(mouse.CursorPos.y>TabSheet1.top+Pict2.top) and
(mouse.CursorPos.y<TabSheet1.top+Pict2.top+Pict1.Height)
then Pict2.Picture.LoadFromFile('pic\text\1.png')
else
Pict2.Picture.LoadFromFile('pic\text\2.png');
end;
end;
Добрый ночи. Возник вопрос.
На форме Panel - внутри PageControl - страница TabSheet1
На TabSheet1 4 изображения.
Как при перемещении одной image менялись все остальные при наведении.
Сверху код работает только на форме (!)
На Tabsheet не получаеться.
image.mouseleave и тд не предлагать, нужны обязательно эти обработчики.
Спасибо :-)