我有
property Background: TPicture read FBackground write SetBackground;
如果没有任何东西被赋予它,那么背景的价值是什么?
我努力了
if Background = NULL then
begin
...
..
...
end;
我有
property Background: TPicture read FBackground write SetBackground;
如果没有任何东西被赋予它,那么背景的价值是什么?
我努力了
if Background = NULL then
begin
...
..
...
end;
这取决于。在构造函数中创建字段并分配 FBackground 时,请使用:
if FBackground.Graphic = nil then
或者:
if not Assigned(FBackground.Graphic) then
如果分配了 Graphic,则使用:
if FBackground.Graphic.Empty then
如果属性和字段都未分配,则使用:
if FBackground = nil then
或者:
if not Assigned(FBackground) then
以上所有组合:
if (FBackground = nil) or (FBackground.Graphic = nil) or FBackground.Graphic.Empty then