放一個 TImage 在 TPanel 上, 並設定 alClient 屬性!
代碼: 選擇全部
procedure Tform1.formCreate(Sender: TObject);
var
cStart, cEnd, cTemp, cSR, cSG, cSB, cER, cEG, cEB: TColor;
i, ir, ig, ib: integer;
width: double;
begin
//Image1.Canvas.FillRect(Rect(0,0,Image1.Width,Image1.Height));
cStart := clRed;
cEnd := clBlue;
cSR := cStart and $000000FF;
cSG := cStart and $0000FF00 shr 8;
cSB := cStart and $00FF0000 shr 16;
cER := cEnd and $000000FF;
cEG := cEnd and $0000FF00 shr 8;
cEB := cEnd and $00FF0000 shr 16;
ir := (cER - cSR) div 100;
ig := (cEG - cSG) div 100;
ib := (cEB - cSB) div 100;
width := Image1.Width / 100;
for i := 0 to 99 do
begin
Image1.Canvas.Brush.Color := (cSR + ir * i) or ((cSG + ig * i) shl <img src=../emoticons/smile.gif> or ((cSB + ib * i) shl 16);
Image1.Canvas.FillRect(Rect(Round(i*width),0,Round((i+1)*width), Image1.Height));
end;
end;
原始參考資料:
http://delphi.ktop.com.tw/topic.asp?topic_id=39056