Иллюстрированный самоучитель по Kylix

       

Обработчик события OnMouseMove



Листинг 13.16.Обработчик события OnMouseMove

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);

begin
if Drawing then
begin
Canvas.Pen.Mode := pmNotXor; case DrawingTool of dtLine: begin
Canvas.MoveTo(Origin.X, Origin.Y);

Canvas.LineTo(MovePt.X, MovePt.Y);

Canvas.MoveTo(Origin.X, Origin.Y);

Canvas.LineTo(X, Y);
end; dtRectangle: begin
Canvas.Rectangle(Origin.X, Origin.Y, MovePt.X, MovePt.Y);

Canvas.Rectangle(Origin.X, Origin.Y, X, Y);
end;
dtEllipse: begin
Canvas.Ellipse(Origin.X, Origin.Y, X, Y);

Canvas.Ellipse(Origin.X, Origin.Y, X, Y);
end;
dtRoundRect: begin
Canvas.RoundRect(Origin.X, Origin.Y, X, Y, (Origin.X - X) div 2, (Origin.Y - Y) div 2);

Canvas.RoundRect(Origin.X, Origin.Y, X, Y,
(Origin.X - X) div 2, (Origin.Y - Y) div 2);
end; end;
MovePt := Point(X, Y);
end; Canvas.Pen.Mode := pmCopy; end;
Назад
Содержание
Вперед


Содержание раздела