Yes :)
void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC0 = CDC::FromHandle(lpDrawItemStruct->hDC);
int iCX = lpDrawItemStruct->rcItem.right;
int iCY = lpDrawItemStruct->rcItem.bottom;
CRgn cRgn1;
cRgn1.CreateRoundRectRgn(0,
0,
lpDrawItemStruct->rcItem.right,
lpDrawItemStruct->rcItem.bottom,
50,
50);
pDC0->SelectClipRgn(&cRgn1);
CDC cMemDC;
cMemDC.CreateCompatibleDC(pDC0);
CDC* pDC = &cMemDC;
CBitmap cBmp;
cBmp.CreateCompatibleBitmap(pDC0, iCX, iCY);
CGdiObject* pcOldBitmap = cMemDC.SelectObject(&cBmp);
pDC->RoundRect(0,
0,
lpDrawItemStruct->rcItem.right,
lpDrawItemStruct->rcItem.bottom,
50,
50);
pDC->FillSolidRect(&lpDrawItemStruct->rcItem, RGB(255, 255, 255));
CRgn cRgn2;
cRgn2.CreateRoundRectRgn(3,
3,
lpDrawItemStruct->rcItem.right-3,
lpDrawItemStruct->rcItem.bottom-3,
50,
50);
pDC->SelectClipRgn(&cRgn2);
int r2=19,g2=40,b2=85;
int r1=60,g1=88,b1=156;
RECT rect = lpDrawItemStruct->rcItem;
for(int i=0;i<rect.bottom;i++) {
int r,g,b;
r = r1 + (i * (r2-r1) / rect.bottom);
g = g1 + (i * (g2-g1) / rect.bottom);
b = b1 + (i * (b2-b1) / rect.bottom);
pDC->FillSolidRect(0,i,rect.right,1,RGB(r,g,b));
}
CString strText;
GetWindowText(strText);
int iOldMode = pDC->SetBkMode(TRANSPARENT);
COLORREF crOldColor = pDC->SetTextColor(RGB(255,255,255));
if (lpDrawItemStruct->itemState & ODS_SELECTED) {
lpDrawItemStruct->rcItem.top += 2;
lpDrawItemStruct->rcItem.left += 2;
}
lpDrawItemStruct->rcItem.top = (lpDrawItemStruct->rcItem.bottom -
lpDrawItemStruct->rcItem.top) /2;
strText = _T("this is a long\ntest text...");
pDC->DrawText(strText, &lpDrawItemStruct->rcItem, DT_CENTER|DT_WORDBREAK );
pDC0->BitBlt(0, 0, iCX, iCY, pDC, 0, 0, SRCCOPY);
pDC->SetTextColor(crOldColor);
pDC->SetBkMode(iOldMode);
pDC->SelectObject(pcOldBitmap);
pDC->DeleteDC();
pDC0->SelectClipRgn(NULL);
}