松鼠的博客

导航

图片自绘背景的对话框程序主要代码

CPaintDC dc(this);
        CRect rect;
        GetClientRect(&rect);//得到窗体的大小
        CDC dcMem;
        dcMem.CreateCompatibleDC(&dc);
        CBitmap bmpBackground;
        bmpBackground.LoadBitmap(IDB_BITMAPBACKGROUND);//加载背景图片
        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);//画窗体

posted on 2008-08-26 13:54  Xproer-松鼠  阅读(496)  评论(0)    收藏  举报