我使用如下语句载入图片到Image中,Image1放在一个ScrollBox中,Image1的属性如下:Top和Left都为0,AutoSize为true,Align属性设置为alNone。 if OpenPictureDialog1.Execute then
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);现在遇到一个问题:当载入的图片大小小于ScrollBox的时候,载入图片之后,我想清空Image1中的内容(用白色清空),语句如下: Image1.Canvas.Brush.Color := clWhite;
Image1.Canvas.Rectangle(Image1.ClientRect);但是清空后Image1的大小变成和它所载入的图片一样大了。我想用Image1.width:=xxx和Image1.height:=xxx来改变它的大小,但是不成功,请问我应该怎么改呢?谢谢了!!
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);现在遇到一个问题:当载入的图片大小小于ScrollBox的时候,载入图片之后,我想清空Image1中的内容(用白色清空),语句如下: Image1.Canvas.Brush.Color := clWhite;
Image1.Canvas.Rectangle(Image1.ClientRect);但是清空后Image1的大小变成和它所载入的图片一样大了。我想用Image1.width:=xxx和Image1.height:=xxx来改变它的大小,但是不成功,请问我应该怎么改呢?谢谢了!!
解决方案 »
- cannot debug project unless a host application is defined use the run/parameters
- 用pos判断一个str中 tab 的位置
- 關於DBGrideh控件的問題
- ~~~~~~~~散分~~~~~~~~
- 在XP下用Delphi5调试MTS对象时发生的一个问题(在线 Up有分)
- Object Pascal 参考手册已发给[email protected]和[email protected],请帮忙上传,谢谢!
- 如何在程序中为数据库表(.DB)建立字段索引??
- 借圣诞喜庆之日,给外甥女征集名字 ,灌水一贴
- 以前用VB,刚刚转入Delphi,不知道API函数在Delphi中如何声明使用,VB中光声明就要写一堆,Delphi呢?烦请举个例:GetComputerName
- 点击Button为什么不执行里面的代码?
- 这段代码哪里错了?
- 请问comboBox如何动态获取数据库中的数据啊
Img1.Picture.Bitmap :=nil;
然后再修改img1的width和height
Image1.Canvas.Rectangle(Image1.ClientRect);感觉好象是Iamge1的Canvas已经被释放了。Image1的颜色变成了和灰色,和它下面ScrollBox的颜色一样。
Image1.Picture.Bitmap.FreeImage;
Image1.Picture.Bitmap :=nil;
//重新设置大小
Image1.Picture.Bitmap.Width := 200;
Image1.Picture.BitMap.Height := 200;
//清空画布
Image1.Canvas.Brush.Color := clWhite;
Image1.Canvas.Rectangle(Image1.ClientRect);