请教!

wwwsoft 2003-10-22 09:59:05
var
pic:TBitmap;
begin
pic:=TBitmap.Create;
pic.LoadFromFile('C:\My Documents\My Pictures\示例图片.bmp');
image1.canvas.Draw(0,0,pic);
pic.Free;
end;

在image1显示的图片与原图片大小不一致,
image1只显示图片的一部分,不是完整的图片。

怎样显示完整的图片?
解决,立即给分,在线等待!

请帮助!
...全文
35 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwwsoft 2003-10-23
  • 打赏
  • 举报
回复
各位,我想在PaintBox1上插入图片?
hiflower 2003-10-23
  • 打赏
  • 举报
回复
paintbox1.canvas.stretchdraw(paintbox1.clientrect,pic);
ColdWolf 2003-10-23
  • 打赏
  • 举报
回复
你可以不使用Draw方法啊,使用Canvas.CopyRect()来指定拷贝的区域和输入的区域啊
hiflower 2003-10-23
  • 打赏
  • 举报
回复
是你的 PaintBox 的尺寸太小了吧?
var
pic:TBitmap;
begin
pic:=TBitmap.Create;
pic.LoadFromFile('E:\My Documents\My Pictures\BMP64\Device.bmp');
paintbox1.Width:=pic.Width;
paintbox1.height:=pic.Height;
PaintBox1.canvas.Draw(0,0,pic);
pic.Free;
end;
itperson 2003-10-22
  • 打赏
  • 举报
回复
procedure TForm1.Button1Click(Sender: TObject);

// This example shows drawing directly to the BitMap
var
x,y : Integer;
BitMap : TBitMap;
P : PByteArray;
begin
BitMap := TBitMap.create;
try
BitMap.LoadFromFile('C:\Program Files\Common Files\Borland Shared\Images\Splash\256color\factory.bmp');
for y := 0 to BitMap.Height -1 do
begin
P := BitMap.ScanLine[y];
for x := 0 to BitMap.Width -1 do
P[x] := y;

end;
Canvas.Draw(0,0,BitMap);
finally
BitMap.Free;
end;
end;
47522341 2003-10-22
  • 打赏
  • 举报
回复
楼主干吗不用Timage控件;设置image1的autosize属性为true就可以了;
wwwsoft 2003-10-22
  • 打赏
  • 举报
回复
问题发错了,下面是正确提问?

var
pic:TBitmap;
begin
pic:=TBitmap.Create;
pic.LoadFromFile('C:\My Documents\My Pictures\示例图片.bmp');
PaintBox1.canvas.Draw(0,0,pic);
pic.Free;
end;

在已绘制的图形的画布上插入另外的图片。
使用了,TCanvas.Draw

PaintBox1只显示图片的一部分,不是完整的图片。

怎样显示完整的图片?
解决,立即给分,在线等待!

请帮助!

5,388

社区成员

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

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