加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

tagBitmap @ DELPHI ???什么类型?

发布时间:2020-12-15 09:44:35 所属栏目:大数据 来源:网络整理
导读:我收到一个错误: [DCC Error] Unit_TProcessClass.pas(334): E2010 Incompatible Type: ‘TBitmap’ and ‘tagBITMAP’ 该类定义为 TMyClass = Class private MyBMP : TBitmap; property aBMP : TBitmap read MyBMP write MyBMP; 代码就像 processABitmap(a
我收到一个错误:

[DCC Error] Unit_TProcessClass.pas(334): E2010 Incompatible Type: ‘TBitmap’ and ‘tagBITMAP’

该类定义为

TMyClass = Class 
private
  MyBMP : TBitmap;
  property aBMP : TBitmap read MyBMP write MyBMP;

代码就像

processABitmap(aMyClass.aBMP) ;  -> here is the compile error !!!

解决方法

问题是VCL中有两种名为TBitmap的类型.一个在Windows单元中定义,另一个在Graphics单元中定义.显然,您将Windows.TBitmap传递给期望Graphics.TBitmap的函数,反之亦然.

您几乎肯定不希望与Windows.TBitmap有任何关系.因此,解决方案是确保所有单元在uses子句中的Windows单元之后列出Graphics单元.这将隐藏Windows.TBitmap的效果.

我的通灵调试表明声明TMyClass的单??位要么在其uses子句中根本不列出Graphics,要么在Windows之前列出Graphics.

最后,你会如何自己做这样的事情?好吧,尝试按CTRL单击TMyClass中引用的TBitmap.我相信他们会带你到Windows中声明的TBitmap.这应该足以让你知道它不是你写TBitmap时的意思.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读