资源预览内容
第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
亲,该文档总共3页全部预览完了,如果喜欢就下载吧!
资源描述
不规则对话框的实现 C+ / 在 OnInitDialog() 时初始化相关数据 HDC hdcs; HBITMAP pBitmap; CBitmap m_bmp;pBitmap = (HBITMAP)LoadImage(NULL,“图片.bmp“,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);hdcs = CreateCompatibleDC(NULL);m_bmp.Attach( pBitmap );BITMAP bm;m_bmp.GetBitmap(CRect rtWindow;GetWindowRect(rtWindow.right = rtWindow.left+bm.bmWidth;rtWindow.bottom =rtWindow.top +bm.bmHeight;MoveWindow(CClientDC dc(this);SetupRegion(/ 最后在 OnPaint 的 else 里面 CClientDC dc(this);CDC picDC; picDC.CreateCompatibleDC (CBitmap *pOldBmp;pOldBmp = picDC.SelectObject (BITMAP bm;m_bmp.GetBitmap(dc.BitBlt (0,0,bm.bmWidth ,bm.bmHeight,dc.SelectObject(pOldBmp);/ 下面是主代码void CtextDemoDlg:SetupRegion(CDC *pDC, CBitmap /创建与传入 DC 兼容的临时 DCmemDC.CreateCompatibleDC(pDC);CBitmap *pOldMemBmp=NULL;/将位图选入临时 DCpOldMemBmp=memDC.SelectObject(CRgn wndRgn;/创建总的窗体区域,初始 region 为0wndRgn.CreateRectRgn(0,0,0,0);BITMAP bit; cBitmap.GetBitmap (/取得位图参数,这里要用到位图的长和宽 int y;for(y=0;yGetWindow();pWnd-SetWindowRgn(wndRgn,TRUE); pWnd-SetForegroundWindow();
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号