主题:Image1.Picture.Graphic.Empty这句代码运行后会出现“EAccessViol
if Image1.Picture.Graphic.Empty then
showmessage('TImage控件中的picture为nil');
上面这句代码运行后就会出现下列错误:
Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 004520EA in module 'Project1.exe'. Read of address 00000000'. Process stopped. Use Step or Run to continue.
(汉化版则显示如下:
工程 Project1.exe 检测到错误类 EAccessViolation, 错误信息: 'Access violation at address 004520D6 in module 'Project1.exe'. Read of address 00000000'. 进程中止. 使用单步或运行继续运行.)
我测试过,如果把代码改为这样:
Image1.Picture.Bitmap.Empty或者Image1.picture.graphic=nil
就不会再出错,在此请教:
这儿的[color=FF0000]Bitmap和Graphic是属性吗[/color]?为何Bitmap.Empty就无错,而Graphic.Empty就会出错。从上面的信息来看,是地址错误,我搜了半天也没搜到相应答案,希望大家给指点一二。
showmessage('TImage控件中的picture为nil');
上面这句代码运行后就会出现下列错误:
Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 004520EA in module 'Project1.exe'. Read of address 00000000'. Process stopped. Use Step or Run to continue.
(汉化版则显示如下:
工程 Project1.exe 检测到错误类 EAccessViolation, 错误信息: 'Access violation at address 004520D6 in module 'Project1.exe'. Read of address 00000000'. 进程中止. 使用单步或运行继续运行.)
我测试过,如果把代码改为这样:
Image1.Picture.Bitmap.Empty或者Image1.picture.graphic=nil
就不会再出错,在此请教:
这儿的[color=FF0000]Bitmap和Graphic是属性吗[/color]?为何Bitmap.Empty就无错,而Graphic.Empty就会出错。从上面的信息来看,是地址错误,我搜了半天也没搜到相应答案,希望大家给指点一二。