|
-
March 28th, 2006, 08:53 PM
#1
Tabbing problem with transparent CButton
Hello Everyone,
This should probably be a quick solution - please help me.
I have successfully gotten transparent background for my CButton class with either
1) return 1 in OnEraseBackground()
2)
Code:
filtering out CButton in OnCtlColor
else if (nCtlColor == CTLCOLOR_BTN)
{
HBRUSH hbr = (HBRUSH)GetStockObject( HOLLOW_BRUSH );
pDC->SetBkMode( TRANSPARENT );
return hbr;
}
That is all good until I realized that the tabbing is screwed with the transparent background of mine.
Normally with 2 buttons, it should toggle between the two with the combinations of:
10 (button1 on focus, button 2 is not)
01 (button1 not focus, button 2 is )
However, now it becomes the following, in another word, there are 2 extra combinations, and I know SetFocus is tabbed to the right button since it invokes the right actions, but the button is just not drawn correctly.
00 (both are not on focus) -> extra !!
10 (button1 on focus, button 2 is not)
11 (both buttons on focus) -> extra
01 (button1 not focus, button 2 is )
I need the transparent background since it is gradient. I have tried the following code and the combination is right:
Code:
void CColorButton::DrawFilledRect(CDC *DC, CRect R)
{
CBrush B;
B.CreateSolidBrush(RGB(250,250,250));
DC->FillRect(R, &B);
}
Why is there 2 extra combinations and how does the window clear and re-draw the background after 4 cycles. I would imagine that it wouldn't. Clearly I am clueless.
Thank you,
Jiac
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|