我做了个雨滴效果显示,
代码如下:
newbmp:=tbitmap.Create;
newbmp.Width:=image1.Width;
newbmp.Height:=image1.Height;
bmpheight:=image1.Height;
bmpwidth:=image1.Width;
for i:=bmpheight downto 1 do
for j:=1 to i do
begin
newbmp.Canvas.CopyRect(rect(0,j-1,bmpwidth,j),
image1.Canvas,Rect(0,i-1,bmpwidth,i));
form1.Canvas.Draw(120,100,newbmp);
end;
newbmp.Free;
运行时报错:说image控件包含bitmap时只能modify
拜托!谢谢!
代码如下:
newbmp:=tbitmap.Create;
newbmp.Width:=image1.Width;
newbmp.Height:=image1.Height;
bmpheight:=image1.Height;
bmpwidth:=image1.Width;
for i:=bmpheight downto 1 do
for j:=1 to i do
begin
newbmp.Canvas.CopyRect(rect(0,j-1,bmpwidth,j),
image1.Canvas,Rect(0,i-1,bmpwidth,i));
form1.Canvas.Draw(120,100,newbmp);
end;
newbmp.Free;
运行时报错:说image控件包含bitmap时只能modify
拜托!谢谢!
newbmp.Canvas.CopyRect(rect(0,j-1,bmpwidth,j),
image1.Canvas,Rect(0,i-1,bmpwidth,i));
改成这样试试
newbmp.Canvas.CopyRect(rect(0,j-1,bmpwidth,j),
image1.Picture.Bitmap.Canvas,Rect(0,i-1,bmpwidth,i));
还有最好用个Try...Finally newbmp.Free; end;