且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

tagBitmap @ DELPHI ???什么样的?

更新时间:1970-01-01 07:58:06

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

The problem is that there are two types named TBitmap in the VCL. One defined in the Windows unit and one defined in Graphics unit. Clearly you are passing Windows.TBitmap to a function expecting Graphics.TBitmap, or vice versa.

你几乎肯定不想与 Windows.TBitmap 有任何关系。所以解决方案是确保您的所有单位列出图形单位 Windows 单位在uses子句中。这将具有隐藏 Windows.TBitmap 的作用。

You almost certainly don't want to have anything to do with Windows.TBitmap. So the solution is to make sure that all of your units list the Graphics unit after the Windows unit in the uses clause. This will have the effect of hiding Windows.TBitmap.

我的心理调试表明,其中 TMyClass 被声明不会列出图形在其中使用子句,或者在 Windows 之前列出 Graphics

My psychic debugging suggests that the unit in which TMyClass is declared either does not list Graphics at all in its uses clause, or it lists Graphics before Windows.

最后,你会如何去做这样的事情呢?那么,尝试按CTRL +点击 TBitmap TMyClass 中引用。我相信他们会带你到 Windows 中声明的 TBitmap 。这应该足够让你明白,当你写 TBitmap 时,这不是你所指的类型。

Finally, how would you go about working out something like this yourself? Well, try pressing CTRL+click on the TBitmap referenced in TMyClass. I'm confident that they will take you to the TBitmap declared in Windows. That should be enough for you to work out that it's not the type that you meant when you wrote TBitmap.