Delphi Timage 介绍和操作[1](图片判断、清空、类型) | 您所在的位置:网站首页 › delphi查找图片在另一个图片中位置 › Delphi Timage 介绍和操作[1](图片判断、清空、类型) |
Delphi Timage 操作(图片判断、清空、类型) 1、Timage 介绍 1.1 介绍 TImage 组件的的使用,主要功能是显示图像、美化界面。TImage 组件经常和TPanel 组件结合使用,以TPanel 组件的边框来划分TImage 组件的边界。在Image 组件调用图片时,可以利用Picture 属性进行指定,也可以在程序中用Picture.LoadFromFile()方法进行调入。利用Picture.SaveToFile()方法可以将TImage 组件的当前显示内容保存为一个图像文件。 1.2 属性 AutoSize //如果此属性设置为True,TImage 组件将自动调整尺寸,以适应图像的大小 Canvas //此属性返回图像的画布,是本组件重要的属性,将在后面的章节中详细介绍 Center //如果此属性设置为True,图像将居中显示 Picture //用于指定TImage 组件上要显示的图像 Proportional //如果此属性设置为True,图像的尺寸将按原来长宽的比例自动调整 Stretch //如果此属性设置为True,图像的尺寸将自动调整并且总是撑满整个TImage 组件 Transparent //如果此属性设为True,图像为透明的,只适合用于图像是BMP 格式2、操作 判断是否有图片: if Image1.Picture.Graphic=nil then showmessage('无图'); if Image1.Picture.Bitmap.Empty then showmessage('无图'); //只对bitmap图有效清空图片: Image1.Picture.Graphic = nil; //清空判断图片类型: Image1.Picture.Graphic is TBitmap //bmp Image1.Picture.Graphic is TJPEGImage //jpg加载和保存图片: Image1.Picture.LoadFromFile(const Filename:String); //打开图片 Image1.Picture.SaveToFile(const Filename:String); //保存图像
创建时间:2020.09.01 更新时间:2020.09.02
|
CopyRight 2018-2019 实验室设备网 版权所有 |