Technology Learning

导航

颜色渐变

procedure TForm24.Button1Click(Sender: TObject);
var
  i,j,ColorR,ColorG,ColorB:integer;
  ColorArea:TRect;
begin
  j:=Form24.Height;
  ColorR:=strToInt(Edit1.Text);
  ColorG:=strToInt(Edit2.Text);
  ColorB:=strToInt(Edit3.Text);
  for i:=StrToInt(Edit5.Text) to StrToInt(Edit6.Text) do
  begin
    if Edit4.Text='R' then
    ColorR:=i
    else if Edit4.Text='G'then
    ColorG:=i
    else if Edit4.Text='B'then
    ColorB:=i;
    Canvas.Brush.Color:=RGB(ColorR,ColorG,ColorB);
    ColorArea:=Rect(i*2,0,(i+1)*2,j);
    Canvas.FillRect(ColorArea);
  end;

end;

posted on 2010-04-07 22:07  浔阳渔夫  阅读(196)  评论(0编辑  收藏  举报