2016-03-02 67 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));