随机产生color
小弟近日在研究tcolor的时候发现一个好玩的东东,其实也很简单了
var
ss:boolean;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
canvas.Pen.Color :=tcolor(rgb(random(255),random(255),random(255)));
canvas.MoveTo(x,y);
ss:=true;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
canvas.Pen.Color :=tcolor(rgb(random(255),random(255),random(255)));
canvas.LineTo(x,y);
ss:=false;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// canvas.Pen.Mode :=pmwhite;
canvas.Pen.Width :=2;
canvas.Pen.Color :=tcolor(rgb(random(255),random(255),random(255)));
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ss then
begin
canvas.Pen.Color :=tcolor(rgb(random(255),random(255),random(255)));
canvas.LineTo(x,y);
end;//end if
end;//end begin
end.