DrawThemeBackground
-
[previously posted on the VC board, no satisfactory answer there so I thought I would repost it on this new forum that may be better suited] Hey all, I am busy updating my CFileEditCtrl class[^] to support XP themes. As part of that update I want the browse button to be drawn the same as a combo box dropdown button, except without the arrow. Using DrawThemeBackground automatically draws the arrow.
HTHEME hTheme = OpenThemeData(*this, L"COMBOBOX");
LRESULT ret = DrawThemeBackground(hTheme, dc, CP_DROPDOWNBUTTON, CBXS_NORMAL, CRect(10, 10, 27, 27), NULL);Is there any option that will draw the themed button background without the arrow? I tried using the scroll bar's thumb as the background as it works fine in silver colour, but not in blue or green.
You may be right
I may be crazy
-- Billy Joel --Within you lies the power for good, use it!!!
-
[previously posted on the VC board, no satisfactory answer there so I thought I would repost it on this new forum that may be better suited] Hey all, I am busy updating my CFileEditCtrl class[^] to support XP themes. As part of that update I want the browse button to be drawn the same as a combo box dropdown button, except without the arrow. Using DrawThemeBackground automatically draws the arrow.
HTHEME hTheme = OpenThemeData(*this, L"COMBOBOX");
LRESULT ret = DrawThemeBackground(hTheme, dc, CP_DROPDOWNBUTTON, CBXS_NORMAL, CRect(10, 10, 27, 27), NULL);Is there any option that will draw the themed button background without the arrow? I tried using the scroll bar's thumb as the background as it works fine in silver colour, but not in blue or green.
You may be right
I may be crazy
-- Billy Joel --Within you lies the power for good, use it!!!
I'd guess your problem is you're using the wrong theme data. Why draw a plain button using a combo box theme? This article might be helpful: Color Picker for WTL with XP themes[^] - the code there draws a button with a dropdown arrow, I imagine you could use the same code, just leave out the arrow drawing.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
-
I'd guess your problem is you're using the wrong theme data. Why draw a plain button using a combo box theme? This article might be helpful: Color Picker for WTL with XP themes[^] - the code there draws a button with a dropdown arrow, I imagine you could use the same code, just leave out the arrow drawing.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
Thanks for the hint, but that is not what I am after.
Michael Dunn wrote:
Why draw a plain button using a combo box theme?
I do not want a plain button. In the default blue theme a plain button has a whitish background with a dark blue border and it shows hot by drawing a yellow box around the client area. A combo box button is different shades of blue depending on it's state. My control is supposed to have the look and feel of a combo box, but the button is supposed to bring up a dialog, not just drop down a list box. As such I want to be able to draw my own icon on the button instead of the arrow. ie I want to draw a disk for saving files, a folder for opening files, a book for opening the windows address book, a printer for selecting a printer, an eye dropper for picking colours, etc. Maybe I am just picky, but there must be a way to draw a button using the same colours as a combobox button. I have no problem doing all the drawing in my own code, I just need to know which APIs I have to call to get the colours needed, how to draw the borders so it matches the current theme and all the fun stuff like that. With a scroll bar thumb the thumb background and the grip are drawn seperately so it is possible to draw the thumb without a grip. I had thought I could use the thumb theme instead of the combo box button for what I want but unfortunately the borders are drawn differently so it just did not look right. If the combo box button had the same drawing principle as the scroll bar thumb and had seperate code for the background and the arrow I would be set, but it does not so I am screwed in my quest.
You may be right
I may be crazy
-- Billy Joel --Within you lies the power for good, use it!!!
-
Thanks for the hint, but that is not what I am after.
Michael Dunn wrote:
Why draw a plain button using a combo box theme?
I do not want a plain button. In the default blue theme a plain button has a whitish background with a dark blue border and it shows hot by drawing a yellow box around the client area. A combo box button is different shades of blue depending on it's state. My control is supposed to have the look and feel of a combo box, but the button is supposed to bring up a dialog, not just drop down a list box. As such I want to be able to draw my own icon on the button instead of the arrow. ie I want to draw a disk for saving files, a folder for opening files, a book for opening the windows address book, a printer for selecting a printer, an eye dropper for picking colours, etc. Maybe I am just picky, but there must be a way to draw a button using the same colours as a combobox button. I have no problem doing all the drawing in my own code, I just need to know which APIs I have to call to get the colours needed, how to draw the borders so it matches the current theme and all the fun stuff like that. With a scroll bar thumb the thumb background and the grip are drawn seperately so it is possible to draw the thumb without a grip. I had thought I could use the thumb theme instead of the combo box button for what I want but unfortunately the borders are drawn differently so it just did not look right. If the combo box button had the same drawing principle as the scroll bar thumb and had seperate code for the background and the arrow I would be set, but it does not so I am screwed in my quest.
You may be right
I may be crazy
-- Billy Joel --Within you lies the power for good, use it!!!
I see now... Unfortunately, the combo box theme only defines one part,
CP_DROPDOWNBUTTON
. If the button border, background, and arrow were separate parts, you could just draw the parts you wanted and leave out the arrow. But it doesn't look like the combo box was set up to do that. :|--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
-
I see now... Unfortunately, the combo box theme only defines one part,
CP_DROPDOWNBUTTON
. If the button border, background, and arrow were separate parts, you could just draw the parts you wanted and leave out the arrow. But it doesn't look like the combo box was set up to do that. :|--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
Yeah, I figured that much out too, hence my question of is there a work around that will allow me to do what I want. Surely there must be a way, even if it ends up being a little convoluted. All I need is a pointer to the correct APIs. So far my searches in MSDN has led nowhere.
You may be right
I may be crazy
-- Billy Joel --Within you lies the power for good, use it!!!