canvas教程

Delphi编程中的图形显示技巧

字号+ 作者:H5之家 来源:H5之家 2016-01-22 10:02 我要评论( )

学delphi编程网,全心全意为delphi新手服务,悉心为delphi新手提供视频教程下载的平台,让你从基础学起,圆你高手梦;争做全国最大的学delphi编程平台。

原理:同垂直交错效果原理一样,只是将分成两组后的图形分别由左右两端移进屏幕。

   程序算法:

procedureTForm1.Button5Click(Sender:TObject);
var
newbmp:TBitmap;
i,j,bmpheight,bmpwidth:integer;
begin
newbmp:=TBitmap.Create;
newbmp.Width:=image1.Width;
newbmp.Height:=image1.Height;
bmpheight:=image1.Height;
bmpwidth:=image1.Width;
i:=0;
whilei<=bmpwidthdo
begin
j:=i;
whilej>0do
begin
newbmp.Canvas.CopyRect(Rect(j-1,0,j,bmpheight),
image1.Canvas,
Rect(bmpwidth-i+j-1,0,bmpwidth-i+j,bmpheight));
newbmp.Canvas.CopyRect(Rect
(bmpwidth-j,0,bmpwidth-j+1,bmpheight),
image1.Canvas,
Rect(i-j,0,i-j+1,bmpheight));
j:=j-2;
end;
form1.Canvas.Draw(120,100,newbmp);
i:=i+2;
end;
newbmp.free;
end;

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • 用Delphi编写打印程序的5个小技巧

    用Delphi编写打印程序的5个小技巧

    2017-04-04 13:00

网友点评