如何选取照片的一部分粘贴到一控件中

jiaxianglei 2002-05-20 01:36:24
我在Delphi6中如何选取照片的一部分(并不是全部)粘贴到一控件中,并在控件中显示出来。不知该用什么控件?如何实现上述功能?
...全文
45 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cndebug 2002-05-20
  • 打赏
  • 举报
回复
你还是现在外部用图象工具裁剪好,然后在LOAD如IMAGE控件吧。
楼上老兄的写法,只能对BMP的起作用,其他格式会出错的!
tygh2000 2002-05-20
  • 打赏
  • 举报
回复
var tbmp:tbitmap; //
procedure TForm1.Button1Click(Sender: TObject);
var img:array[0..2,0..2] of timage;
var i,j,step:integer;
begin

step:=tbmp.Width div 3;
for i:=0 to 2 do
begin
for j:=0 to 2 do
begin
img[i,j]:=timage.create(application);
img[i,j].parent :=form1;
img[i,j].Left :=j*step+10*j;
img[i,j].top :=i*step+10*i;
img[i,j].width :=step;
img[i,j].height:=step;
img[i,j].Canvas.CopyRect(rect(0,0,step,step),tbmp.Canvas ,rect(j*step,i*step,j*step+step,i*step+step));
end;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
tbmp:=tbitmap.Create ;
tbmp.LoadFromFile('c:\1.bmp');
end;
black_fox 2002-05-20
  • 打赏
  • 举报
回复
var
Bitmap: TBitmap;
MyRect, MyOther: TRect;
begin

MyRect := Rect(10,10,100,100);

MyOther := Rect(10,111,100, 201);
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('c:\windows\tartan.bmp');
Form1.Canvas.BrushCopy(MyRect, Bitmap, MyRect, clBlack);
Form1.Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);
Bitmap.Free;
hammer_shi 2002-05-20
  • 打赏
  • 举报
回复
photoshop!

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧