unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 =
class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
const
PenStyle = PS_Geometric
or PS_Solid;
var
LogBrush: TLOGBRUSH;
begin
LogBrush.lbStyle := BS_Solid;
LogBrush.lbColor := Form1.Image1.Canvas.Pen.Color;
LogBrush.lbHatch := 0;
with Form1.Image1.Canvas
do
begin
Pen.Handle := ExtCreatePen(PS_Geometric+PS_Dash+PS_Endcap_Square+PS_Join_Round, 50, LogBrush, 0,
nil);
end;
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Image1.Canvas.MoveTo(x, y);
end;
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Image1.Canvas.LineTo(X, Y);
end;
end.