Problem with CButton (shape, size, appearance)
Posted on 1998-12-19
I'm using a derived class for the CButton object which allows me to change the shape of the push button. Although I can get the shape to change (an ellipse for example), the grey corners still show on the button. This isn't a problem when in a dialog, because the background is also grey and it blends, but my app uses a green background.
When creating a CButton derived object inside my application (not CForm view or CRecordView or in a dialog ), the derived class calculates the lighting, etc. and draws the button as the regular CButton class would, except that it draws the button face as any shape desired. The problem here is that the actual space taken up by the button is still rectangular, which means that ugly grey corners still show on the button (when using ellipse for example).
I don't want to cover it with rectangular bitmaps, because that will defeat the whole purpose and I would have to match the bitmap corners with my app's background colors, etc... That would be a pain.
When I actually create the CButton derived button, I'm forced to pass a RECT or CRect object, so it appears that this is my road-block, but I don't know how to tackle this problem. If I could change the actual size that the button itself occupies, I think everything would be fine, but for now, I'm stuck.
I've tried this with & w/out BS_OWNERDRAW.
I think dealRect is the real problem here.
m_dealButton.Create("Deal", BS_OWNERDRAW | VISIBLE,
dealRect, this, 7);
Call to derived CButton class with predefined shape.
Not particularly important, but shown so that it's
known that it's called after button is created.
Does anybody know of a way to get around this problem? Please let me know if any further explaination, source, link to derived class source on web, picture of problem button, etc.... is needed.