错误C2664:'Gdiplus :: Bitmap :: LockBits':无法将参数1从'Gdiplus :: Rect'转换为'const Gdiplus :: Rect *' [英] error C2664: 'Gdiplus::Bitmap::LockBits' : cannot convert parameter 1 from 'Gdiplus::Rect' to 'const Gdiplus::Rect *'

查看:609
本文介绍了错误C2664:'Gdiplus :: Bitmap :: LockBits':无法将参数1从'Gdiplus :: Rect'转换为'const Gdiplus :: Rect *'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是指针概念的弱点所以​​任何人都可以告诉我为什么会出现以下错误。



错误C2664:'Gdiplus :: Bitmap :: LockBits':无法将参数1从'Gdiplus :: Rect'转换为'const Gdiplus :: Rect *'



我的工作如下

Hi everybody,

I am some what weak in pointer concept so can any body tell me why is below error is come into picture.

error C2664: 'Gdiplus::Bitmap::LockBits' : cannot convert parameter 1 from 'Gdiplus::Rect' to 'const Gdiplus::Rect *'

I am doing as below

    BitmapData bmData;
Rect rect(0, 0, width, height);

b->LockBits(rect,
    ImageLockModeRead,
    PixelFormat32bppARGB,
    &bmData);





和b是类型位图的对象



and b is the object of type bitmap

Bitmap *b





请告诉我如何解决这个问题



谢谢



Please tell me how to resolve this

Thanks

推荐答案

正确阅读错误消息将告诉您如何在大多数情况下纠正错误消息。



从错误消息中您可以看到它试图将Rect转换为Rect指针。

现在从文档中可以看到预期的第一个参数是指向Rect的指针。

所以你simple返回Rect的地址。
Reading the error message properly will tell you how to correct it most of the time.

From the error message you can see that it is trying to convert the Rect to a Rect pointer.
Now from the documentation you can see that the expected first parameter is a pointer to a Rect.
So you simple return the address of the Rect.


这篇关于错误C2664:'Gdiplus :: Bitmap :: LockBits':无法将参数1从'Gdiplus :: Rect'转换为'const Gdiplus :: Rect *'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆