您现在的位置:首页 >> 图形媒体 >> 图形媒体 >> 内容

Delphi将JPG分割到三个TImage里面的例子

时间:2011/9/3 15:02:03 点击:

  核心提示:procedureTForm1.Button1Click(Sender:TObject);varRect1,Rect2,Rect3:TRect;bmp:TBitmap;w,h:integer;begi...
procedure TForm1.Button1Click(Sender: TObject);
var Rect1,Rect2,Rect3:TRect;
    bmp:TBitmap;
    w,h:integer;
begin

  bmp:= TBitmap.Create;
  bmp.Assign(Image1.Picture.Graphic);
  w:=Image1.Width ;
  h:=Image1.Height div 3;
  Rect1:=Rect(0,0,w,h);
  Rect2:=Rect(0,h,w,h*2);
  Rect3:=Rect(0,h*2,w,h*3);
  with Image2 do
     begin
       Height:=h;
       Width:=w;
       Canvas.CopyRect(Rect1,bmp.Canvas,Rect1);
     end;
  with Image3 do
    begin
      Height:=h;
      Width:=w;
      Canvas.CopyRect(Rect1,bmp.Canvas,Rect2);
    end;
  with Image4 do
    begin
      Height:=h;
      Width:=w;
      Canvas.CopyRect(Rect1,bmp.Canvas,Rect3);
    end;
    bmp.Free;
end;

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
本类推荐
  • 没有
本类固顶
  • 没有
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号