15,979
社区成员
发帖
与我相关
我的任务
分享
HBRUSH CDlg::OnCtlColor(CDC *pDC,CWnd* pWnd ,UINT nCtlColor)
{
HBRUSH hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
if(CTLCOLOR_STATIC == nCtlColor && pWnd->GetDlgCtrlID() == IDC_PIC)
{
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
}
return hbr;
}
void CDlg::OnPaint()
{
CPaintDC dc(this);
HTHEME hTheme = OpenThemeData(AfxGetMainWnd()->GetSafeHwnd(), _T("TAB"));
RECT rcdlg;
::GetClientRect(m_hWnd,&rcdlg);
DrawThemeBackground(hTheme,dc,TABP_BODY,0,&rcdlg,NULL);
CDialog::OnPaint();
}
CString strIconPath("icon.ico");
Graphics graphics(::GetDC(GetDlgItem(IDC_PIC)->m_hWnd));
Image image(strThemePicPath.AllocSysString());
graphics.DrawImage(&image, 0, 0);
Graphics graphics(::GetDC(GetDlgItem(IDC_PIC)->m_hWnd));
Image image(L"icon.ico");
graphics.DrawImage(&image, 0, 0);
HBRUSH CDlg::OnCtlColor(CDC *pDC, CWnd* pWnd, UINT nCtlColor)
{
if (nCtlColor == CTLCOLOR_STATIC)
{
return CreateSolidBrush(pDC->GetPixel(0, 0));
}
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}