HBRUSH CCircleDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP1); CBrush pbr;
pbr.CreatePatternBrush(&bmp);
hbr = (HBRUSH)pbr; HBRUSH brush = CreatePatternBrush((HBITMAP)bmp); // TODO: Return a different brush if the default is not desired
return hbr;
}
我如果返回hbr就没有值,如果返回brush就有值,请问这是为什么?
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP1); CBrush pbr;
pbr.CreatePatternBrush(&bmp);
hbr = (HBRUSH)pbr; HBRUSH brush = CreatePatternBrush((HBITMAP)bmp); // TODO: Return a different brush if the default is not desired
return hbr;
}
我如果返回hbr就没有值,如果返回brush就有值,请问这是为什么?
bmp.LoadBitmap(IDB_BITMAP1);
pbr.CreatePatternBrush(&bmp);
放入到OnInitDialog中