楼主可以看看TCanvas类
Canvas 是画布, Pen 是画笔, Brush 是画刷,procedure TForm1.Button1Click(Sender: TObject);
begin
Canvas.Pen.Color := clRed; {设置画笔颜色}
Canvas.Pen.Width := 2; {设置画笔宽度}
Canvas.MoveTo(10,10); {直线起点}
Canvas.LineTo(100,100); {直线终点}
end;
{矩形填充}
procedure TForm1.Button2Click(Sender: TObject);
begin
Canvas.Brush.Color := clYellow; {设置画刷颜色, 也就是填充色}
Canvas.FillRect(ClientRect); {填充窗体客户区}
end;
procedure TForm1.Button2Click(Sender: TObject);
var
R: TRect; {定义一个矩形结构}
begin
btn := TButton(Sender);
R := Rect(btn.Left, y1, btn.Left+btn.Width, y2);
Canvas.Rectangle(R);
end;
{绘制圆角矩形; 最后两个参数是设置圆角的}
procedure TForm1.Button3Click(Sender: TObject);
begin
btn := TButton(Sender);
Canvas.RoundRect(btn.Left, y1, btn.Left+btn.Width, y2, 20,20);
end;
更多可看万一博客 http://www.cnblogs.com/del/category/123038.html
|