Re: Owner-Draw Round Button
If i call setwindowrgn, and then draw rectangle or draw a bigger size than
button control, i expected to see round image. Because i call setwindowrgn.
But it is not. It is confused me
I mean as you said. This works. It shows round button:
CRgn Region;
Region.CreateRoundRectRgn(rc.left,rc.top,rc.right,rc.bottom,100,100);
CBrush br;
br.CreateSolidBrush(RGB(255,0,0));
pDC->FillRgn(&Region, &br);
but if i replace FillRgn with FillsolidRectangle
pDC->FillSolidRect(rc, RGB(255,0,0));
draws rectangle. But i called setwindowrgn. Why does it still draw rectangle?
Thanks
"msnews.microsoft.com" wrote:
Why don't you want to use Region Functions (FillRgn) instead?
Victor
"sawer" <sawer@discussions.microsoft.com> wrote in message
news:6E505265-1696-477A-AE0F-FB15B22975DD@microsoft.com...
void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItem)
{
CDC* pDC = CDC::FromHandle(lpDrawItem->hDC);
CRect rect = lpDrawItem->rcItem;
pDC->SelectStockObject(NULL_BRUSH);
pDC->FillSolidRect(rect, RGB(255,0,0));
}
void CMyButton::PreSubclassWindow()
{
CRect rc;
GetClientRect( &rc );
CRgn Region;
Region.CreateRoundRectRgn(rc.left,rc.top,rc.right,rc.bottom,50,50);
SetWindowRgn(Region,TRUE);
CButton::PreSubclassWindow();
}
I don't understand.
Calling SetWindowRgn is not enough?
I'm calling SetWindowRgn but it still draw rectangle when calling
FillSolidRect?
I don't figure out how DrawItem must be?