怎样使作为FORM背景的图片在SHOW FORM 时立即显示? 100分奉上。(100分)

  • 主题发起人 主题发起人 fanofdelphi
  • 开始时间 开始时间
F

fanofdelphi

Unregistered / Unconfirmed
GUEST, unregistred user!
FORM在显示时,会先显示自己的颜色(如黑色),然后才显示它上面的图片,结果是先黑一下,然后才显示背景图片。怎样才能直接立即显示图片而不黑一下哪?
 
这个可能没有办法,因为先是create出form,然后再于form,生成image的,所以如果机子速度慢的话
肯定会有这么个过程的,没有办法吧,可能有高手会在form上直接画图上去。
 
在FormCreate里
Canvas.Brush.Style := bsClear;
 
form1.brush.style:=bsclear;
form1.borderstyle:=bsnone;
 
参考这个程序,就可以做出那种效果来[red][/red]

在form1上放入Image1、Button1,装入bmp位图,设置Autosize:=true,在Button1的Click编写如下事件:
procedure TForm1.Button1Click(Sender: TObject);
var
x,y,i: integer;
ptr : PByteArray;
begin
image1.Picture.Bitmap.PixelFormat:=pf24bit;
for i := 1 to 255 do
begin
for y := 0 to image1.Height - 1 do
begin
ptr := image1.Picture.Bitmap.ScanLine[y];
for x := 0 to ((image1.Width *3) - 1) do
begin
if i<126 then
begin
if ptr[x] > 1 then ptr[x] := ptr[x] - 2;//2用来调整速度
end
else //后部分加快速度
if ptr[x] > 9 then ptr[x] := (ptr[x] - 10);
end;

end;

Canvas.Draw(0,0,image1.Picture.Bitmap);
Application.ProcessMessages;
end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部