Visual C++ 开发实战宝典
void CP400Dlg::OnPaint()
{
。。。。
CBitmap bmp;
bmp.LoadBitmap(IDB_YCH);
BITMAP bmInfo;
bmp.GetBitmap(&bmInfo);
int nBmpWidth,nBmpHeight;
nBmpWidth = bmInfo.bmWidth;
nBmpHeight = bmInfo.bmHeight;
CRect clientRC;
GetClientRect(clientRC);
CDC *pDC = GetDC();
CDC memDC;
memDC.CreateCompatibleDC(pDC);
memDC.SelectObject(&bmp);
pDC->StretchBlt(0,0,clientRC.Width(),clientRC.Height(),&memDC,0,0,nBmpWidth,nBmpHeight,SRCCOPY);
memDC.DeleteDC();
bmp.DeleteObject();
pDC->SetBkMode(TRANSPARENT);
CFont font;
font.CreatePointFont(350,"华文行楷",pDC);
pDC->SelectObject(&font);
pDC->SetTextColor(RGB(0,0,255));
马弗罐pDC->SetBkColor(RGB(255,0,0));
pDC->TextOut(10,20,"。");
pDC->TextOut(10,90,"引无数英雄竞折腰。");
}功能:静态文本框去除背景,透明。
HBRUSH CP400Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
液压压力机液压压力机
冲压滤网// TODO: Change any attributes of the DC here
if (nCtlColor = CTLCOLOR_STATIC)
{
if (pWnd == GetDlgItem(IDC_STATIC1))
{
尼龙包胶线
豆袋弹 pDC->SetBkColor(RGB(125,255,0));
//文字背景
pDC->SetTextColor(RGB(255,0,0)); //文字颜
pDC->SetBkMode(TRANSPARENT); //不显示文字背景
汽车水箱除垢剂
hbr = (HBRUSH)::GetStockObject(NULL_BRUSH); //编辑框背景。注意:和文字背景不是一个意思。
}
}
// TODO: Return a different brush if the default is not desired
return hbr;
}效果: