RayUp
RayUp

Reputation: 95

DrawState with specific width and height

I'm trying to draw an disabled icon with the method DrawState. My problem now is that the width (parameter BUTTONWIDTH) and height (parameter BUTTONHEIGHT) are ignored by this method.

Is there another method available or do I need to change some parameters?

void CPgFPButton::DrawButtonIcon(LPDRAWITEMSTRUCT lpdis, HICON hicon)
{
    RECT rect = lpdis->rcItem;
    rect.left = 3;
    rect.top  = 3;

    if (!m_Enabled)
        DrawState(lpdis->hDC,NULL, NULL, (LPARAM)hicon, (WPARAM)NULL,
                  rect.left, rect.top, BUTTONWIDTH, BUTTONHEIGHT, 
                  DST_COMPLEX | DST_ICON|DSS_DISABLED);
    else            
        DrawIconEx(lpdis->hDC,
                   rect.left,rect.top,hicon,
                   BUTTONWIDTH - 3 * 2,
                   BUTTONHEIGHT - 3 * 2,0,NULL,DI_NORMAL);
}

Upvotes: 0

Views: 524

Answers (1)

Werner Henze
Werner Henze

Reputation: 16726

From MSDN:

The image type and state. This parameter can be one of the following type values.
DST_COMPLEX
DST_ICON

This parameter can also be one of the following state values.
DSS_DISABLED

You are passing DST_COMPLEX | DST_ICON|DSS_DISABLED. It looks like you should decide whether to use DST_COMPLEX or DST_ICON and not use both. Remind: width and height are only used for DST_COMPLEX.

Upvotes: 1

Related Questions