当前位置: 首页>>代码示例>>C++>>正文


C++ CDC::DeleteDC方法代码示例

本文整理汇总了C++中CDC::DeleteDC方法的典型用法代码示例。如果您正苦于以下问题:C++ CDC::DeleteDC方法的具体用法?C++ CDC::DeleteDC怎么用?C++ CDC::DeleteDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDC的用法示例。


在下文中一共展示了CDC::DeleteDC方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnNcPaint

void CSizingControlBar::OnNcPaint()
{
    // get window DC that is clipped to the non-client area
    CWindowDC dc(this); // the HDC will be released by the destructor

    CRect rcClient, rcBar;
    GetClientRect(rcClient);
    //mpc-hc custom code start
    //ClientToScreen(rcClient);
    //mpc-hc custom code end
    GetWindowRect(rcBar);
    //mpc-hc custom code start
    // Convert to client coordinates to account for possible RTL layout
    ScreenToClient(rcBar);
    //mpc-hc custom code end
    rcClient.OffsetRect(-rcBar.TopLeft());
    rcBar.OffsetRect(-rcBar.TopLeft());

    CDC mdc;
    mdc.CreateCompatibleDC(&dc);
    
    CBitmap bm;
    bm.CreateCompatibleBitmap(&dc, rcBar.Width(), rcBar.Height());
    CBitmap* pOldBm = mdc.SelectObject(&bm);

    // draw borders in non-client area
    CRect rcDraw = rcBar;
    DrawBorders(&mdc, rcDraw);

    // erase the NC background
//mpc-hc custom code start
    mdc.FillRect(rcDraw, CBrush::FromHandle(
        (HBRUSH) GetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND)));
//mpc-hc custom code end

    if (m_dwSCBStyle & SCBS_SHOWEDGES)
    {
        CRect rcEdge; // paint the sizing edges
        for (int i = 0; i < 4; i++)
            if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
                mdc.Draw3dRect(rcEdge, ::GetSysColor(COLOR_BTNHIGHLIGHT),
                    ::GetSysColor(COLOR_BTNSHADOW));
    }

    NcPaintGripper(&mdc, rcClient);

    // client area is not our bussiness :)
    dc.IntersectClipRect(rcBar);
    dc.ExcludeClipRect(rcClient);

    dc.BitBlt(0, 0, rcBar.Width(), rcBar.Height(), &mdc, 0, 0, SRCCOPY);

    mdc.SelectObject(pOldBm);
    bm.DeleteObject();
    mdc.DeleteDC();
}
开发者ID:1ldk,项目名称:mpc-hc,代码行数:56,代码来源:sizecbar.cpp

示例2: OnPaint

void CMatrixStatic::OnPaint(HWND hWnd) 
{

COLORREF SEGM_COLORS[3] = {
	RGB(63, 181, 255),	// BLUE ON
	RGB(23, 64,  103),	// BLUE OFF
	RGB(0,  0,   0),	// BLACK
};
	RECT rc;
	CRect m_rect;
	GetClientRect(&m_rect);
	int x = 0, y = 0;
	int strlen = m_csStrText.GetLength();
	if (strlen == 0)
		return;
	CPaintDC dc(this); // device context for painting
	HBITMAP bmp;
	COLORMAP	ColorMap[4];;
	ColorMap[0].from = SEGM_COLORS[0]; 
	ColorMap[0].to  = m_crOnColor;
	ColorMap[1].from = SEGM_COLORS[1]; 
	ColorMap[1].to  = m_crOffColor;
	ColorMap[2].from = SEGM_COLORS[2]; 
	ColorMap[2].to  = m_crBackColor;
	//bmp = ::CreateMappedBitmap(AfxGetInstanceHandle(), m_iImagematrix, 0, ColorMap, 3); //@@code modify -->
	bmp = ::CreateMappedBitmap(GetThisModule(), m_iImagematrix, 0, ColorMap, 3);
	CDC dcMemory;
	dcMemory.CreateCompatibleDC(&dc);	// Select the bitmap into the in-memory DC
	//CBitmap* pOldBitmap = dcMemory.SelectObject(CBitmap::FromHandle(bmp)); //@@code modify -->
	HBITMAP pOldBitmap = dcMemory.SelectObject(bmp);
	int charcount = 0;
	int linecount = 1;
	HBRUSH hbBkBrush = CreateSolidBrush(m_crBackColor);
	FillRect(dc.m_hDC, &m_rect, hbBkBrush);
	for (int ix = 0; ix < strlen; ix++)
	{
		GetCharBmpOffset(&rc, (char)m_csStrText[ix]);
		dc.BitBlt(x, y, (m_icharwidth + m_ixspacing), (m_icharheight+m_iyspacing), &dcMemory, rc.left, rc.top, SRCCOPY);
		x += m_icharwidth + m_ixspacing;
		charcount++;
		if ((charcount == m_iMaxXChars) && m_iMaxYChars == 1)
			break;
		else if ((charcount == m_iMaxXChars) && m_iMaxYChars > 1)
		{
			if (linecount == m_iMaxYChars)
				break;
			x = charcount = 0;
			y += m_icharheight + m_iyspacing;
			linecount++;
		}
	}
	dcMemory.SelectObject(pOldBitmap);
	dcMemory.DeleteDC();
	DeleteObject(bmp);
	DeleteObject(hbBkBrush);
}
开发者ID:xushiwei,项目名称:winx,代码行数:56,代码来源:MatrixStatic.cpp

示例3: PrepareWindow

// Protected member functions
BOOL COXScreenGrabber::PrepareWindow(BOOL bClient, CRect& ScrRect, CWnd* pWnd)
{
	if (pWnd == NULL)
		pWnd = CWnd::GetForegroundWindow();
	if (pWnd == NULL)
		pWnd = CWnd::GetDesktopWindow();

	ASSERT(pWnd != NULL);
	if (!pWnd->IsWindowVisible())
		return FALSE;

	if (pWnd == CWnd::GetDesktopWindow())
	{
		// create a DC for the screen and create
		CDC SreenDC;
		if (!SreenDC.CreateDC(_T("DISPLAY"), NULL, NULL, NULL))
			return FALSE;

		// get screen resolution and set Rect
		ScrRect.left = 0;
		ScrRect.top = 0;
		ScrRect.right = SreenDC.GetDeviceCaps(HORZRES);
		ScrRect.bottom = SreenDC.GetDeviceCaps(VERTRES);

		SreenDC.DeleteDC();
	}
	else
	{
		// Move window which was selected to top of Z-order for
		// the capture, and make it redraw itself
		pWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_NOSIZE | SWP_NOMOVE);
		pWnd->UpdateWindow();

		if (bClient)
		{
			// get the client area dimensions
			pWnd->GetClientRect(&ScrRect);

			// convert client coords to screen coords
			CPoint pt1(ScrRect.left, ScrRect.top); 
			CPoint pt2(ScrRect.right, ScrRect.bottom); 

			pWnd->ClientToScreen(&pt1);
			pWnd->ClientToScreen(&pt2);

			ScrRect.left = pt1.x;
			ScrRect.top = pt1.y;
			ScrRect.right = pt2.x;
			ScrRect.bottom = pt2.y;
		}
		else
			pWnd->GetWindowRect(&ScrRect);
	}

	return TRUE;
}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:57,代码来源:OXScreenGrab.cpp

示例4: OnPaint

void CDLGTabPic::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	// TODO: Add your message handler code here

	// Do not call CDialog::OnPaint() for painting messages
	//贴背景图	
	CRect    rect;     
	GetClientRect(&rect);     

	//从资源中载入位图     
	CBitmap    bitmap;     
	bitmap.LoadBitmap(IDB_FIND_BACK);    
	BITMAP bmp;
	bitmap.GetBitmap(&bmp);

	CDC    memdc;     
	memdc.CreateCompatibleDC(&dc);     
	memdc.SelectObject(bitmap); 
	dc.SetStretchBltMode(COLORONCOLOR);
	dc.StretchBlt(0,0,rect.Width(),rect.Height(),&memdc,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
	memdc.DeleteDC();


	int w,h;

	if(bim)
	{
		//显示图片
		CDC *pDC=m_pic.GetDC();
		CRect rect; 
		m_pic.GetClientRect(&rect);//获得pictrue控件所在的举行区域

		PicAutoWH(rect.Width(),rect.Height(),pic._GetWidth(),pic._GetHeight(),&w,&h);

		pic.DrawPicture(*pDC, (rect.Width()-w)/2,(rect.Height()-h)/2,w,h);
		m_pic.ReleaseDC(pDC);
	}

	if(bimsmall)
	{
		//显示图片
		CDC *pDCsmall=m_pic_small.GetDC();
		CRect rectsmall; 
		m_pic_small.GetClientRect(&rectsmall);//获得pictrue控件所在的举行区域

		PicAutoWH(rectsmall.Width(),rectsmall.Height(),picsmall._GetWidth(),picsmall._GetHeight(),&w,&h);

		picsmall.DrawPicture(*pDCsmall,(rectsmall.Width()-w)/2,(rectsmall.Height()-h)/2,w,h);
		m_pic_small.ReleaseDC(pDCsmall);
	}

	GetDlgItem(IDC_STATIC_TXT)->SetWindowText(m_txt);
	CDialog::OnPaint();
}
开发者ID:dulton,项目名称:brpj,代码行数:56,代码来源:DLGTabPic.cpp

示例5: OnDraw

void CMFCWorldView::OnDraw(CDC* pDC)
{
	//获取文档
	CMFCWorldDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;
	//准备内存绘图缓冲区
	CDC MemDC;
	CBitmap MemBitmap;
	MemDC.CreateCompatibleDC(NULL);//创建绘图设备
	//绘图区域大小,可以像这样中直接使用窗口大小,也可以自己计算需要多大的区域
	MemBitmap.CreateCompatibleBitmap(pDC,870,510);CBitmap *pOldBit=MemDC.SelectObject(&MemBitmap);//创建绘图区
	MemDC.FillSolidRect(0,0,870,510,RGB(255,255,255));//初始化
	//读取文档
	char** p;
	p = pDoc->getmap(5);
	//画刷定义
	int wallc=RGB(0,0,0);//墙是黑色
	CBrush wallBrush(wallc);
	int playc=RGB(0,255,0);//玩家是绿色
	CBrush playBrush(playc);
	int exitc=RGB(255,0,0);//出口是红色
	CBrush exitBrush(exitc);
	CBrush *oldBrush;
	//缓冲区绘图
	for (int i = 0; i <= 2*MM; ++i)
	{
		for (int j = 0; j <= 2*NN; ++j)
		{
			switch (p[j][i])
			{
			case WALL:
				oldBrush = MemDC.SelectObject(&wallBrush);
				MemDC.Rectangle(Start+i*cubelong,Start+j*cubelong,Start+(i+1)*cubelong,Start+(j+1)*cubelong);
				MemDC.SelectObject(oldBrush);
				break;
			case PLAY:
				oldBrush = MemDC.SelectObject(&playBrush);
				MemDC.Rectangle(Start+i*cubelong,Start+j*cubelong,Start+(i+1)*cubelong,Start+(j+1)*cubelong);
				MemDC.SelectObject(oldBrush);
				break;
			case EXIT:
				oldBrush = MemDC.SelectObject(&exitBrush);
				MemDC.Rectangle(Start+i*cubelong,Start+j*cubelong,Start+(i+1)*cubelong,Start+(j+1)*cubelong);
				MemDC.SelectObject(oldBrush);
			}
		}
	}
	//将内存中的图拷贝到屏幕上进行显示 
	pDC->BitBlt(0,0,870,510,&MemDC,0,0,SRCCOPY); 
	//绘图完成后的清理 
	MemBitmap.DeleteObject(); 
	MemDC.DeleteDC(); 

}
开发者ID:SineSoft,项目名称:MazeByMFC,代码行数:56,代码来源:MFCWorldView.cpp

示例6: AFCStretchImage

//绘画透明图
bool AFCStretchImage(CDC * pDesDC, int iXDes, int iYDes, int iDesWidth, int iDesHeight, HBITMAP hBitBmp, int iXScr, int iYScr, int iScrWidth, int iScrHeight, COLORREF crColor)
{
	CDC MemDC;
	MemDC.CreateCompatibleDC(pDesDC);
	MemDC.SelectObject(hBitBmp);
	//return AFCStretchBlt(pDesDC,iXDes,iYDes,iDesWidth,iDesHeight,&MemDC,iXScr,iYScr,iScrWidth,iScrHeight,crColor);
	bool b = ::TransparentBlt(pDesDC->GetSafeHdc(),iXDes,iYDes,iDesWidth,iDesHeight,MemDC.GetSafeHdc(),iXScr,iYScr,iScrWidth,iScrHeight,crColor);
	MemDC.DeleteDC();
	return b;
}
开发者ID:liuwanbing,项目名称:liuwanbing,代码行数:11,代码来源:AFCFunction.cpp

示例7: OnEraseBkgnd

BOOL CSingleExamDlg::OnEraseBkgnd(CDC* pDC)
{
	CDialog::OnEraseBkgnd(pDC);

	CRect rcClient;
	GetClientRect(&rcClient);

	pDC->FillRect(rcClient, &CBrush(RGB(255, 255, 255)));	//225, 242, 250

	//画虚线
	if (GetDlgItem(IDC_STATIC_ExamTime)->GetSafeHwnd())
	{
		CPen *pOldPen = NULL;
		CPen pPen;
		pPen.CreatePen(PS_DASH, 1, RGB(106, 218, 239));
		pOldPen = pDC->SelectObject(&pPen);

		CRect rtTmp;
		GetDlgItem(IDC_STATIC_ExamTime)->GetWindowRect(rtTmp);
		ScreenToClient(&rtTmp);

		CPoint pt1, pt2;
		pt1.x = rtTmp.left;
		pt1.y = rtTmp.bottom + 1;
		pt2.x = pt1.x + 350;
		pt2.y = pt1.y;
		pDC->MoveTo(pt1);
		pDC->LineTo(pt2);
		pDC->SelectObject(pOldPen);
		pPen.Detach();
	}
	DrawBorder(pDC);

	int iX, iY;
	CDC memDC;
	BITMAP bmp;
	if (memDC.CreateCompatibleDC(pDC))
	{
		CBitmap *pOldBmp = memDC.SelectObject(&m_bmpExamType);
		m_bmpExamType.GetBitmap(&bmp);
		pDC->SetStretchBltMode(COLORONCOLOR);
		pDC->StretchBlt(rcClient.right - bmp.bmWidth - 10, 1, bmp.bmWidth, bmp.bmHeight, &memDC, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);


		pOldBmp = memDC.SelectObject(&m_bmpExamTypeLeft);
		m_bmpExamTypeLeft.GetBitmap(&bmp);
		pDC->SetStretchBltMode(COLORONCOLOR);
		pDC->StretchBlt(rcClient.left, rcClient.top, bmp.bmWidth, rcClient.bottom, &memDC, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);

		memDC.SelectObject(pOldBmp);
	}
	memDC.DeleteDC();

	return TRUE;
}
开发者ID:jf4210,项目名称:src2-test,代码行数:55,代码来源:SingleExamDlg.cpp

示例8: OnPaint

void CLineDiffBar::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	CRect rect;
	GetClientRect(rect);
	int height = rect.Height();
	int width = rect.Width();

	CDC cacheDC;
	VERIFY(cacheDC.CreateCompatibleDC(&dc));
	cacheDC.FillSolidRect(&rect, ::GetSysColor(COLOR_WINDOW));
	if (m_pCacheBitmap == NULL)
	{
		m_pCacheBitmap = new CBitmap;
		VERIFY(m_pCacheBitmap->CreateCompatibleBitmap(&dc, width, height));
	}
	CBitmap *pOldBitmap = cacheDC.SelectObject(m_pCacheBitmap);

	CRect upperrect = CRect(rect.left, rect.top, rect.right, rect.bottom/2);
	CRect lowerrect = CRect(rect.left, rect.bottom/2, rect.right, rect.bottom);

	if ((m_pMainFrm)&&(m_pMainFrm->m_pwndLeftView)&&(m_pMainFrm->m_pwndRightView))
	{
		CLeftView* leftView = m_pMainFrm->m_pwndLeftView;
		CRightView* rightView = m_pMainFrm->m_pwndRightView;
		if ((leftView->IsWindowVisible())&&(rightView->IsWindowVisible()))
		{
			BOOL bViewWhiteSpace = leftView->m_bViewWhitespace;
			BOOL bInlineDiffs = leftView->m_bShowInlineDiff;
			
			leftView->m_bViewWhitespace = TRUE;
			leftView->m_bShowInlineDiff = TRUE;
			leftView->m_bShowSelection = false;
			rightView->m_bViewWhitespace = TRUE;
			rightView->m_bShowInlineDiff = TRUE;
			rightView->m_bShowSelection = false;

			// Use left and right view to display lines next to each other
			leftView->DrawSingleLine(&cacheDC, &upperrect, m_nLineIndex);
			rightView->DrawSingleLine(&cacheDC, &lowerrect, m_nLineIndex);

			leftView->m_bViewWhitespace = bViewWhiteSpace;
			leftView->m_bShowInlineDiff = bInlineDiffs;
			leftView->m_bShowSelection = true;
			rightView->m_bViewWhitespace = bViewWhiteSpace;
			rightView->m_bShowInlineDiff = bInlineDiffs;
			rightView->m_bShowSelection = true;
		}
	} 

	VERIFY(dc.BitBlt(rect.left, rect.top, width, height, &cacheDC, 0, 0, SRCCOPY));

	cacheDC.SelectObject(pOldBitmap);
	cacheDC.DeleteDC();
}
开发者ID:fatterbetter,项目名称:ZTools,代码行数:55,代码来源:LineDiffBar.cpp

示例9: CreatePrinterDC

BOOL CWinApp::CreatePrinterDC(CDC& dc)
{
	HDC hDC = AfxCreateDC(m_hDevNames, m_hDevMode);
	if (hDC != NULL)
	{
		dc.DeleteDC();
		VERIFY(dc.Attach(hDC));
		return TRUE;
	}
	return FALSE;
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:11,代码来源:appprnt.cpp

示例10: DrawBitmap

void CxSkinButton::DrawBitmap(CDC* dc, HBITMAP hbmp, RECT r, int DrawMode)
{
//	DrawMode: 0=Normal; 1=stretch; 2=tiled fill
	if(DrawMode==2){
		FillWithBitmap(dc,hbmp,r);
		return;
	}
	if(!hbmp) return;	//safe check

	int cx=r.right  - r.left;
	int cy=r.bottom - r.top;
	CDC dcBmp,dcMask;
	dcBmp.CreateCompatibleDC(dc);
	dcBmp.SelectObject(hbmp);
	
	if (m_bMask.m_hObject!=NULL){
		dcMask.CreateCompatibleDC(dc);
		dcMask.SelectObject(m_bMask);

		CDC hdcMem;
		hdcMem.CreateCompatibleDC(dc);
	    CBitmap hBitmap;
		hBitmap.CreateCompatibleBitmap(dc,cx,cy);
	    hdcMem.SelectObject(hBitmap);
		
        hdcMem.BitBlt(r.left,r.top,cx,cy,dc,0,0,SRCCOPY);
		if(!DrawMode){
			hdcMem.BitBlt(r.left,r.top,cx,cy,&dcBmp,0,0,SRCINVERT);
			hdcMem.BitBlt(r.left,r.top,cx,cy,&dcMask,0,0,SRCAND);
			hdcMem.BitBlt(r.left,r.top,cx,cy,&dcBmp,0,0,SRCINVERT);
		} else {
			int bx=GetBitmapWidth(hbmp);
			int by=GetBitmapHeight(hbmp);
			hdcMem.StretchBlt(r.left,r.top,cx,cy,&dcBmp,0,0,bx,by,SRCINVERT);
			hdcMem.StretchBlt(r.left,r.top,cx,cy,&dcMask,0,0,bx,by,SRCAND);
			hdcMem.StretchBlt(r.left,r.top,cx,cy,&dcBmp,0,0,bx,by,SRCINVERT);
		}
        dc->BitBlt(r.left,r.top,cx,cy,&hdcMem,0,0,SRCCOPY);

		hdcMem.DeleteDC();
		hBitmap.DeleteObject();

		DeleteDC(dcMask);
	} else {
		if(!DrawMode){
			dc->BitBlt(r.left,r.top,cx,cy,&dcBmp,0,0,SRCCOPY);
		} else {
			int bx=GetBitmapWidth(hbmp);
			int by=GetBitmapHeight(hbmp);
			dc->StretchBlt(r.left,r.top,cx,cy,&dcBmp,0,0,bx,by,SRCCOPY);
		}
	}
	DeleteDC(dcBmp);
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:54,代码来源:xSkinButton.cpp

示例11:

void CUserModify2::DrawRangeImage(int i, CDC *pDC, CRect rc){
	HBITMAP hBitmap1 = NULL;
	HBITMAP hBitmap2 = NULL;
	CBitmap bit[2];
	if(hBitmap1 ==NULL||hBitmap2 ==NULL){

		hBitmap1 = (HBITMAP)::LoadImage(NULL,_T("images/top.bmp"), 
			IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE|LR_LOADFROMFILE);
		hBitmap2 = (HBITMAP)::LoadImage(NULL,_T("images/band.bmp"), 
			IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE|LR_LOADFROMFILE);
		if(hBitmap1 == NULL||hBitmap2 == NULL)
		{
			AfxMessageBox(_T("无法加载图片"));
			PostQuitMessage(0);
		}
		if (bit[0].m_hObject)
			bit[0].Detach();
		if (bit[1].m_hObject)
			bit[1].Detach();
		bit[0].Attach(hBitmap1);
		bit[1].Attach(hBitmap2);
	}


	CDC MemDC;
	BITMAP bm;
	bit[i].GetBitmap(&bm);

	int li_Width = bm.bmWidth;
	int li_Height = bm.bmHeight;


	MemDC.CreateCompatibleDC(pDC);
	CBitmap* pOldBitmap = MemDC.SelectObject(&bit[i]);

	int x=rc.left;
	int y=rc.top;

	while (y < (rc.Height()+rc.top)) 
	{
		while(x < (rc.Width()+rc.left)) 
		{
			pDC->BitBlt(x, y, li_Width, li_Height, &MemDC, 0, 0, SRCCOPY);
			x += li_Width;
		}
		x = rc.left;
		y += li_Height;
	}

	//pDC->StretchBlt(x, y, rc.right - rc.left, rc.bottom - rc.top, &MemDC, 0, 0,2,2 ,SRCCOPY);
	MemDC.SelectObject(pOldBitmap);
	MemDC.DeleteDC();

}
开发者ID:dulton,项目名称:nampu,代码行数:54,代码来源:UserModify2.cpp

示例12: CreateTransparentColorBitmap

// 从一个位图创建一个加上透明颜色的位图
HBITMAP CCatchScreenDlg::CreateTransparentColorBitmap(CDC *pDC, CBitmap* pOrgBitmap, const CRect& rcRect)
{
	// 创建一个与屏幕设备描述表兼容的位图
	HBITMAP hBitmap = CreateCompatibleBitmap(pDC->GetSafeHdc(),rcRect.Width() , rcRect.Height());
	CDC dcMem;
	dcMem.CreateCompatibleDC(pDC);
	// 把新位图选到内存设备描述表中
	HBITMAP hOldBitmap = (HBITMAP) dcMem.SelectObject(hBitmap);
	CDC dcCompatible;
	dcCompatible.CreateCompatibleDC(CDC::FromHandle(dcMem.m_hDC));
	HBITMAP hOldBitmap2 =  (HBITMAP)dcCompatible.SelectObject(pOrgBitmap->GetSafeHandle());

	dcMem.BitBlt(0, 0, rcRect.Width() , rcRect.Height(),&dcCompatible, 0, 0, SRCCOPY);
	DrawTransparentColor(&dcMem,rcRect);
	hBitmap = (HBITMAP)dcMem.SelectObject(hOldBitmap);
	dcCompatible.SelectObject(hOldBitmap2);
	dcCompatible.DeleteDC();
	dcMem.DeleteDC();
	return hBitmap;
}
开发者ID:sxcong,项目名称:fytPhoto,代码行数:21,代码来源:CatchScreenDlg.cpp

示例13: GetRegion

HRGN CSkinWin::GetRegion(int w, int h)
{
    CWnd *pWnd = CWnd::FromHandle(m_hWnd);
    CRect wr;
    pWnd->GetWindowRect(wr);
	//SKIN_SHANG 右边框
	//wr.left+=m_BorderRightWidth;
    
    CRgn rgn;
    if ( m_bTrans )
    {
        CDC *pDC = pWnd->GetDC();
        CDC memDC;
        CMyBitmap bmp;
        CBitmap *obmp;
        memDC.CreateCompatibleDC(pDC);
        bmp.CreateCompatibleBitmap( pDC, w, m_TitleHeight );
        obmp = memDC.SelectObject(&bmp);
        /*
        memDC.FillSolidRect( 0, 0, w, h, 0 );
        DrawFrame( &memDC, 0, 0, w, h, 0 );
        */
        DrawTitle( &memDC, m_BorderLeftWidth , 0, 
                   wr.Width() - m_BorderRightWidth - m_BorderLeftWidth + 1, 0 );
        DrawLeft( &memDC, 0, 0, m_bmpLeft.Height(), 0 );
		//SKIN_SHANG 右边框
        DrawRight( &memDC, wr.Width() - m_BorderRightWidth , 0, m_bmpRight.Height(), 0 );
        
        memDC.SelectObject(obmp);

		//wyw
		memDC.DeleteDC();

        pWnd->ReleaseDC( pDC );

        rgn.CreateRectRgn( 0, m_TitleHeight, wr.Width(), wr.Height() );
        HRGN hrgn = bmp.CreateRgnFromFile( m_colTrans );
        CRgn newrgn;
        newrgn.CreateRectRgn( 0, m_TitleHeight, wr.Width(), wr.Height() );
        newrgn.CombineRgn( &rgn, CRgn::FromHandle(hrgn), RGN_XOR  );

		//wyw
		bmp.DeleteObject();
		DeleteObject(hrgn);
		rgn.DeleteObject();
        
        return (HRGN)newrgn.Detach();
    }
    else
        rgn.CreateRectRgn( 0, 0, wr.Width(), wr.Height() );
        
    
    return (HRGN)rgn.Detach();
}
开发者ID:jiangchengxu,项目名称:spreadtrum-w160,代码行数:54,代码来源:SkinWin.cpp

示例14: AlphaDrawImage

//透明绘画
bool CSkinImage::AlphaDrawImage(CDC * pDestDC, int xDest, int yDest, int cxDest, int cyDest, int xSrc, int ySrc, COLORREF crTrans)
{
	//效验状态
	if (IsNull()) return false;

	//建立 DC
	CDC DCImage;
	DCImage.CreateCompatibleDC(pDestDC);
	DCImage.SelectObject(HBITMAP(*this));
	DCImage.SetBkColor(crTrans);
	DCImage.SetBkMode(TRANSPARENT);

	//建立掩码图
	CDC DCMask;
	CBitmap BMPMask;
	BMPMask.CreateBitmap(cxDest,cyDest,1,1,NULL);
	DCMask.CreateCompatibleDC(pDestDC);
	DCMask.SelectObject(&BMPMask);
	DCMask.BitBlt(0,0,cxDest,cyDest,&DCImage,xSrc,ySrc,SRCCOPY);

	//绘画目标图
	CDC DCDest;
	CBitmap BMPDest;
	DCDest.CreateCompatibleDC(pDestDC);
	BMPDest.CreateCompatibleBitmap(pDestDC,cxDest,cyDest);
	DCDest.SelectObject(&BMPDest);
	DCDest.BitBlt(0,0,cxDest,cyDest,pDestDC,xDest,yDest,SRCCOPY);
	DCDest.BitBlt(0,0,cxDest,cyDest,&DCImage,xSrc,ySrc,SRCINVERT);
	DCDest.BitBlt(0,0,cxDest,cyDest,&DCMask,0,0,SRCAND);
	DCDest.BitBlt(0,0,cxDest,cyDest,&DCImage,xSrc,ySrc,SRCINVERT);
	pDestDC->BitBlt(xDest,yDest,cxDest,cyDest,&DCDest,0,0,SRCCOPY);

	//清理资源
	DCMask.DeleteDC();
	DCDest.DeleteDC();
	DCImage.DeleteDC();
	BMPMask.DeleteObject();
	BMPDest.DeleteObject();
	
	return true;
}
开发者ID:275958081,项目名称:netfox,代码行数:42,代码来源:SkinImage.cpp

示例15: SetSCBStyle

CCoolBar::CCoolBar() {
    m_hNotifyWnd = NULL;
    m_cyGripper = 12;
    SetSCBStyle(GetSCBStyle() |	SCBS_SIZECHILD);
    m_bActive = FALSE;
    CDC dc;
    dc.CreateCompatibleDC(NULL);
    m_sFontFace = (::EnumFontFamilies(dc.m_hDC,
                                      _T("宋体"), (FONTENUMPROC) EnumFontFamProc, 0) == 0) ?
                  _T("宋体") : _T("Tahoma");
    dc.DeleteDC();
}
开发者ID:Codiscope-Research,项目名称:ykt4sungard,代码行数:12,代码来源:scbarg.cpp


注:本文中的CDC::DeleteDC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。