2016-03-02 70 views
-1

我在项目中遇到了一些在C++中使用GDI plus的问题。我目前只是试图创建一个空白的位图,以便稍后绘制它,但我遇到了一些问题。我当前的代码是这样的:GDI +位图问题

reptileRect.Height = windowHeight/9; 
reptileRect.Width = windowWidth/15; 
reptileRect.Y = (windowHeight - (windowHeight/4)); 
reptileRect.X = windowWidth * ratio; 



Bitmap bmp = Bitmap((INT)(reptileRect.Width * 2), (INT)(reptileRect.Width * 2)); 

但我发现了一个错误的效果:

"Gdiplus::Bitmap::Bitmap(const Gdiplus::Bitmap &)" (declared at line 638 of "c:\Program Files (x86)\Windows Kits\8.1\Include\um\gdiplusheaders.h") is inaccessible 

'Gdiplus::Bitmap::Bitmap': cannot access private member declared in class 'Gdiplus::Bitmap'

有谁知道为什么发生这种情况?

感谢

+0

哇,好吧,我发誓我通常不是这个笨蛋,谢谢。 –

回答

1

位图拷贝构造函数是私有的,以防止Bitmap类的复制(见相关话题How to return a GDI::Bitmap from a function)。我想你应该尝试直接初始化bmp

Bitmap bmp((INT)(reptileRect.Width * 2), (INT)(reptileRect.Width * 2));