unit MainUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    UpDown1: TUpDown;
    Button1: TButton;
    ColorDialog1: TColorDialog;
    procedure FormPaint(Sender: TObject);
    procedure UpDown1Click(Sender: TObject; Button: TUDBtnType);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormPaint(Sender: TObject);
begin
 Canvas.Pen.Style:=psSolid;
 Canvas.MoveTo(10,20);
 Canvas.LineTo(200,20);

 Canvas.Pen.Style:=psDash;
 Canvas.MoveTo(10,40);
 Canvas.LineTo(200,40);

 Canvas.Pen.Style:=psDot;
 Canvas.MoveTo(10,60);
 Canvas.LineTo(200,60);

 Canvas.Pen.Style:=psDashDot;
 Canvas.MoveTo(10,80);
 Canvas.LineTo(200,80);

 Canvas.Pen.Style:=psDashDotDot;
 Canvas.MoveTo(10,100);
 Canvas.LineTo(200,100);

 Canvas.Pen.Style:=psClear;
 Canvas.MoveTo(10,120);
 Canvas.LineTo(200,120);

 Canvas.Pen.Style:=psInsideFrame;
 Canvas.MoveTo(10,140);
 Canvas.LineTo(200,140);
end;

procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
begin
 Canvas.Pen.Width:=UpDown1.Position;
 Repaint;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 if ColorDialog1.Execute then
  Canvas.Pen.Color:=ColorDialog1.Color;
 FormPaint(nil);
end;

end.
