有关label背景色的问题(50分)

L

lg_pope

Unregistered / Unconfirmed
GUEST, unregistred user!
在背景色变化的窗体内,如何让label的背景色和它周围的颜色相一致。如编写一个窗体颜色由蓝色逐渐变成了黑色程序。
procedure TForm1.formpaint(sender:tobject);
var
i:word;
y,ystep:real;
begin
y:=0;
ystep:=clientheight/256;
for i:=255 downto 0 do
begin
canvas.brush.color:=$00000000+i*$10000;
canvas.fillrect(rect(0,round(y),clientwidth,round(y+ystep)));
y:=y+ystep;
end;

 
procedure TForm1.FormCreate(Sender: TObject);
begin
Label1.Transparent:=true;
Label1.Caption:='123'+chr(13)+'222';

end;
 
ledo:我知道你所说的方法,但程序运行后,label的背景色总是隐约有一长方形灰色图形与窗口背景色不一致,不停的闪烁,不知有没有方法消除
,谢谢!
 
接受答案了.
 
顶部