Why is it that simple things never work? Latest in the long list of small idiosyncrasies is the behavior of button control, one of the oldest controls. While experimenting with some code I accidentally made button a child of the (transparent) group box, only to be rewarded by strange black rectangle around the button?!? After some time I had a flashback and looked into code of simple owner drawn button to find following intriguing lines:
if (IsThemeBackgroundPartiallyTransparent(hTheme, BP_PUSHBUTTON, iStateId))
{
  DrawThemeParentBackground(m_hWnd, lpDIS->hDC, rect);
}

This made me suspect that normal buttons don't check transparency (which would be relatively obvious bug) so to verify, I made one owner drawn button child of the same group box and lo and behold, it draws correctly. How come nobody noticed this? I guess this is a question for Raymond Chen, who keeps excellent weblog full of answers to questions like this.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
0 Comments