
20.01.2010, 17:47
|
Модератор
|
|
Регистрация: 17.04.2008
Сообщения: 8,097
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
|
|
Первый способ:
Код:
procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
If X < PaintBox1.Width / 2
Then ShowMessage('Left')
Else ShowMessage('Right');
end;
Второй способ:
Код:
procedure TForm1.PaintBox1Click(Sender: TObject);
var
P : TPoint;
begin
P := Mouse.CursorPos;
P := PaintBox1.ScreenToClient(P);
If P.X < PaintBox1.Width / 2
Then ShowMessage('Left')
Else ShowMessage('Right')
end;
|