现在的位置: 首页 > 综合 > 正文

重绘对话框的特定位置背景

2013年07月19日 ⁄ 综合 ⁄ 共 544字 ⁄ 字号 评论关闭

void CTestDlg::OnPaint()
{
     CRect r;
     GetClientRect(&r);

     CPaintDC dc(this);
        CRect rect=CRect(0,0,r.Width()*0.2,r.Height()*0.3);
        //GetClientRect(&rect);//µÃµ½´°ÌåµÄ´óС
        CDC dcMem;
        dcMem.CreateCompatibleDC(&dc);
        CBitmap bmpBackground;
        bmpBackground.LoadBitmap(IDB_BITMAP2);//¼ÓÔر³¾°Í¼Æ¬
        BITMAP bitMap;
        bmpBackground.GetBitmap(&bitMap);
        CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground);
        dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,bitMap.bmWidth,bitMap.bmHeight,SRCCOPY);
 }

抱歉!评论已关闭.