void CMainDlg::OnDrawItem ( UINT uID, LPDRAWITEMSTRUCT lpdis )
{
CDCHandle
dc = lpdis->hDC;
CRect rcCtrl = lpdis->rcItem;
CString sText;
const UINT uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX;
if ( IDC_CLOCK != uID || ODT_STATIC != lpdis->CtlType )
{
SetMsgHandled(false);
return;
}
m_wndTimeLabel.GetWindowText ( sText );
[b]
if ( IsCompositionEnabled() )
{
// Set up a memory
DC where we'll draw the text.
CDC dcMem;
dcMem.CreateCompatibleDC (
dc );
dcMem.SaveDC();
// Create a 32-bit bmp for use in offscreen drawing when glass is on
BITMAPINFO dib = {0};
CBitmap bmp;
dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
dib.bmiHeader.biWidth = rcCtrl.Width();
dib.bmiHeader.biHeight = -rcCtrl.Height(); // negative because DrawThemeTextEx() uses a top-down DIB
dib.bmiHeader.biPlanes = 1;
dib.bmiHeader.biBitCount = 32;
dib.bmiHeader.biCompression = BI_RGB;[/b]
//habe ich auch übersetzt aber geht bei mir nicht!!
bmp.CreateDIBSection (
dc, &dib, DIB_RGB_COLORS, NULL, NULL, 0 );
// Set up the
DC state.
DTTOPTS dto = { sizeof(DTTOPTS) };
dto.dwFlags = DTT_COMPOSITED|DTT_GLOWSIZE;
dto.iGlowSize = 10;
//wie übersetz ich das hier??
dcMem.SelectBitmap ( bmp );
dcMem.SelectFont ( m_font );
DrawThemeTextEx ( m_hTheme, dcMem, 0, 0, CT2CW(sText), -1, uFormat, rcCtrl, &dto );
dc.BitBlt ( rcCtrl.left, rcCtrl.top, rcCtrl.Width(), rcCtrl.Height(), dcMem, 0, 0, SRCCOPY );
dcMem.RestoreDC(-1);
}
//der teil ist nicht so wichtig!!
else
{
dc.SaveDC();
dc.FillSolidRect ( rcCtrl, GetSysColor(COLOR_3DFACE) );
dc.SetBkMode ( TRANSPARENT );
dc.SetTextColor ( GetSysColor(COLOR_WINDOWTEXT) );
dc.SelectFont ( m_font );
dc.DrawText ( CT2CW(sText), -1, rcCtrl, uFormat );
dc.RestoreDC(-1);
}
}