I am trying to imitate the look of a thematic imperfect combobox ( CBS_DROPDOWNLIST ) using DrawThemeBackground . I supply the part of CP_READONLY , which, apparently, draws the background of the thematic calculation:
DrawThemeBackground(theme, dc, CP_READONLY, CBRO_NORMAL, &rectangle, nullptr);
However, it does not contain a drop-down arrow. So, I tried to draw the arrow myself as follows:
rectangle.left = rectangle.right - 20; DrawThemeBackground(theme, dc, CP_DROPDOWNBUTTONRIGHT, CBXSR_NORMAL, &rectangle, nullptr);
But the above draws an arrow centered inside the rectangle against the background of the combo box, including the border, so I cannot use this without having a border inside the drop-down sign (which already has a border). I used theme-explorer to make sure that the arrow is always in the background with borders.
In essence, my question is: How to draw a background and an arrow in the corresponding position to emulate the appearance of a regular window with a list of windows?
What I have found out so far:
I can specify a clipping rectangle to squeeze the above borders. But this raises the question of determining the exact position rectangle and the clipping rectangle: It seems that I can use GetThemeMargins to define the margins, but that does not tell me how big the arrow is as a whole.
GetThemeBitmap may be useful in determining the exact size of the arrow, but when I read it here and confirmed on my machine, using it with TMT_GLYPHDIBDATA does not work as advertised, and I would like to go without any workarounds if possible.
source share