"Maxime Bellengé" maxime.bellenge@laposte.net wrote:
Changelog:
- Fix the creation of treeview with checkboxes. Now they display fine.
The only real change in this patch is the following snippet. Could you retest and send only that chunk alone?
@@ -4848,12 +4850,14 @@ DrawFrameControl(hdc, &rc, DFC_BUTTON, DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED);
+ SelectObject(hdc, hbmOld); nIndex = ImageList_AddMasked(infoPtr->himlState, hbm, GetSysColor(COLOR_WINDOW)); TRACE("chckbox index %d\n", nIndex); - SelectObject(hdc, hbmOld);
-- Dmitry.
Yes it is exactly what is it supposed to do, the location of the SelectObject is the problem. You can only select a HBITMAP in only one DC. As ImageList_AddMasked performs a SelectObject with hbm, you have to deselect it first.
Without that, the paint of the checkboxes in the treeview are messed up.
Maxime
On Sun, 2003-08-17 at 05:40, Dmitry Timoshkov wrote:
"Maxime Bellengé" maxime.bellenge@laposte.net wrote:
Changelog:
- Fix the creation of treeview with checkboxes. Now they display fine.
The only real change in this patch is the following snippet. Could you retest and send only that chunk alone?
@@ -4848,12 +4850,14 @@ DrawFrameControl(hdc, &rc, DFC_BUTTON, DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED);
- SelectObject(hdc, hbmOld); nIndex = ImageList_AddMasked(infoPtr->himlState, hbm, GetSysColor(COLOR_WINDOW)); TRACE("chckbox index %d\n", nIndex);
- SelectObject(hdc, hbmOld);
-- Dmitry.
Sorry, I sent the last mail a bit quickly.
The rest of the patch is important in my opinion because without it, the drawing is done black and white. So you can reduce the patch to that only line but it is not what I wanted.
- hdc = CreateCompatibleDC(0); - hbm = CreateCompatibleBitmap(hdc, 48, 16);
hbm is a 1 bit per pixel bitmap
+ hdcScreen = CreateDCA("DISPLAY", NULL, NULL, NULL); + + hdc = CreateCompatibleDC(hdcScreen); + hbm = CreateCompatibleBitmap(hdcScreen, 48, 16);
hbm has now a screen compliant depth
In a treeview, the checkbox is not B/W. If there is another way to do it please tell me. But I think this part of the patch is important
Maxime
On Sun, 2003-08-17 at 05:40, Dmitry Timoshkov wrote:
"Maxime Bellengé" maxime.bellenge@laposte.net wrote:
Changelog:
- Fix the creation of treeview with checkboxes. Now they display fine.
The only real change in this patch is the following snippet. Could you retest and send only that chunk alone?
@@ -4848,12 +4850,14 @@ DrawFrameControl(hdc, &rc, DFC_BUTTON, DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED);
- SelectObject(hdc, hbmOld); nIndex = ImageList_AddMasked(infoPtr->himlState, hbm, GetSysColor(COLOR_WINDOW)); TRACE("chckbox index %d\n", nIndex);
- SelectObject(hdc, hbmOld);
-- Dmitry.
"Maxime Bellengé" maxime.bellenge@laposte.net wrote:
hdc = CreateCompatibleDC(0);
hbm = CreateCompatibleBitmap(hdc, 48, 16);
hbm is a 1 bit per pixel bitmap
hdcScreen = CreateDCA("DISPLAY", NULL, NULL, NULL);
hdc = CreateCompatibleDC(hdcScreen);
hbm = CreateCompatibleBitmap(hdcScreen, 48, 16);
hbm has now a screen compliant depth
You are right. Probably it's better to just replace CreateCompatibleBitmap() by CreateBitmap() with the desired number of bits per pixel. In any case send what you see more appropriate.
-- Dmitry.
According to MSDN, it is said that CreateCompatibleBitmap should be used whenever a color bitmap is created. Moreover, with CreateBitmap, I have to know the depth of the screen whereas with CreateCompatibleBitmap I don't need to.
Dmitry (or others), do you really think this patch can't be applied as is. I will add some comments as suggested by Marcelo Duarte.
Max
On Tue, 2003-08-19 at 04:42, Dmitry Timoshkov wrote:
"Maxime Bellengé" maxime.bellenge@laposte.net wrote:
hdc = CreateCompatibleDC(0);
hbm = CreateCompatibleBitmap(hdc, 48, 16);
hbm is a 1 bit per pixel bitmap
hdcScreen = CreateDCA("DISPLAY", NULL, NULL, NULL);
hdc = CreateCompatibleDC(hdcScreen);
hbm = CreateCompatibleBitmap(hdcScreen, 48, 16);
hbm has now a screen compliant depth
You are right. Probably it's better to just replace CreateCompatibleBitmap() by CreateBitmap() with the desired number of bits per pixel. In any case send what you see more appropriate.
-- Dmitry.
"Maxime Bellengé" maxime.bellenge@laposte.net wrote:
According to MSDN, it is said that CreateCompatibleBitmap should be used whenever a color bitmap is created. Moreover, with CreateBitmap, I have to know the depth of the screen whereas with CreateCompatibleBitmap I don't need to.
Dmitry (or others), do you really think this patch can't be applied as is. I will add some comments as suggested by Marcelo Duarte.
As I already have said, send what you see is more appropriate.
-- Dmitry.