OwnerDrawn control in MFC

I am creating an MFC application that has a skin library that handles the UI effect for rendering controls (it is called in oninitdialog). But in the meantime, I also have a requirement to display the icon on the buttons. To do this, I mark the buttons as ownerdrawn = true and am able to display the icon, but in this case, the skin effect does not occur on those buttons whose own processing is done by me. So my question is how can I guarantee that the control will be passed to me as well as any other library.

+1


source to share


2 answers


Call the default handler for OnPaint to make sure the skin library has the ability to paint the button, then paint your own content on top.



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

      

+1


source


You don't need to paint the owner to draw icons in buttons.



+1


source







All Articles