我程序中的表单上有一个 TImage 组件。
在某些情况下,程序必须测试:
如果“有一个图像分配给了 TImage 组件的图片属性”那么......
我该怎么做?
最佳答案
if Image1.Picture.Graphic = NIL
then ShowMessage("There is no image.")
else ShowMessage("Image found.");
如果使用位图,您也可以这样做:
if Image.Picture.Bitmap.Empty then ShowMessage("There is no spoon");
关于delphi - 如何测试 TImage 是否分配了图形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2717990/