views:

261

answers:

2

Hi, I am creating a MFC application in which there is a skin library which handles the UI effect of rendering the controls (it gets called in oninitdialog). But, meanwhile, I have also the requirement of displaying an icon on the buttons. For this, I am marking the buttons as ownerdrawn=true, and able to display icon, but in this case, skin effect is not taking place on those buttons whose ownerdrawing is done by me. So, my question is, how do I ensure that a control gets ownedrawn by me, and also by any other library.

+1  A: 

Call the default handler for OnPaint to make sure the skinning library has a chance to draw the button, then draw your own content over the top.

void OnPaint()
{
    Default();
    CClientDC dc(this);
    // your painting code goes here
}
Mark Ransom
A: 

You don't need owner-draw to display icons in buttons !