VC6.0下MFC的雙緩存顏色顯示問題

參考了多個網上的有關雙緩存的資料,都只是講簡單的怎樣實現雙緩存,而我在MFC的對話中調用了SelectObject等方法來重置不同顏色的畫筆和畫刷,而且設置多次,查來查去找不到解決的辦法,後來看了CSDN的相關文檔才解決了。
以下是相關的原文解讀:(CreateCompatibleBitmap方法,注意是Windows GDI: Platform SDK中的)

Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, the bitmap that is created is a monochrome bitmap. To create a color bitmap, use the hDC that was used to create the memory device context, as shown in the following code:

 

If an application sets the nWidth or nHeight parameters to zero, CreateCompatibleBitmap returns the handle to a 1-by-1 pixel, monochrome bitmap.

看來要存放的緩存格式(樣式)要和原來的客戶區一致就可以實現非黑白單色的彩色了,順便給出自己的部分代碼:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章