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


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

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


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

示例1: BitBlt

void SelectionHandler::BitBlt(CDC& offscreenDC)
{
	if (m_selectionState == selstateNoSelection) return;

	COORD	coordStart;
	COORD	coordEnd;
	SHORT	maxX = (m_consoleParams->dwBufferColumns > 0) ? static_cast<SHORT>(m_consoleParams->dwBufferColumns - 1) : static_cast<SHORT>(m_consoleParams->dwColumns - 1);

	GetSelectionCoordinates(coordStart, coordEnd);
	coordStart.X	= 0;
	coordEnd.X		= maxX;

	CRect	selectionRect;
	GetFillRect(coordStart, coordEnd, selectionRect);

	offscreenDC.BitBlt(
					selectionRect.left, 
					selectionRect.top, 
					selectionRect.Width(), 
					selectionRect.Height(), 
					m_dcSelection, 
					selectionRect.left, 
					selectionRect.top, 
					SRCINVERT);
}
开发者ID:minagi,项目名称:console,代码行数:25,代码来源:SelectionHandler.cpp

示例2: DrawItem

void CBigIcon::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
    ASSERT(pDC != NULL);

	HPALETTE hPalette = WFE_GetUIPalette(NULL);
	HPALETTE hOldPalette = ::SelectPalette(lpDrawItemStruct->hDC, hPalette, FALSE);
	::RealizePalette(lpDrawItemStruct->hDC);

    CRect rect;
    GetClientRect(rect);
    int cxClient = rect.Width();
    int cyClient = rect.Height();

    // draw the bitmap contents
    CDC dcMem;
    if (!dcMem.CreateCompatibleDC(pDC))
        return;
    HBITMAP hOldBitmap = (HBITMAP)::SelectObject(dcMem.m_hDC, m_hBitmap);
    if (hOldBitmap == NULL)
        return;

    pDC->BitBlt(0, 0, m_sizeBitmap.cx, m_sizeBitmap.cy, &dcMem, 0, 0, SRCCOPY);

    ::SelectObject(dcMem.m_hDC, hOldBitmap);
	DisplayCopyright();
	::SelectPalette(lpDrawItemStruct->hDC, hOldPalette, TRUE);

    ReleaseDC(pDC);
}
开发者ID:vicamo,项目名称:b2g_mozilla-central,代码行数:30,代码来源:splash.cpp

示例3: DrawControl

void CDuiAnimateImage::DrawControl(CDC &dc, CRect rcUpdate)
{
	int nWidth = m_rc.Width();
	int nHeight = m_rc.Height();

	if(!m_bUpdate)
	{
		UpdateMemDC(dc, nWidth * m_nMaxIndex, nHeight);

		Graphics graphics(m_memDC);
		
		CPoint point = GetOriginPoint(nWidth, nHeight, m_sizeImage.cx, m_sizeImage.cy,
						GetGDIAlignment(m_uAlignment), GetGDIVAlignment(m_uVAlignment));

		for(int i = 0; i < m_nMaxIndex; i++)
		{
			m_memDC.BitBlt(i * nWidth, 0, nWidth, nHeight, &dc, m_rc.left ,m_rc.top, SRCCOPY);

			graphics.DrawImage(m_pImage, Rect(point.x , point.y,  m_sizeImage.cx, m_sizeImage.cy),
				i * m_sizeImage.cx, 0, m_sizeImage.cx, m_sizeImage.cy, UnitPixel);

			point.x += nWidth;
		}
	}

	dc.BitBlt(m_rc.left,m_rc.top, m_rc.Width(), m_rc.Height(), &m_memDC, m_nIndex * nWidth, 0, SRCCOPY);
}
开发者ID:LLLiuWeicai,项目名称:webposclient,代码行数:27,代码来源:Runing.cpp

示例4: OnEraseBkgnd

BOOL CommandButton::OnEraseBkgnd(CDC* pDC)
{
	if (m_Bmp.GetSafeHandle() == NULL)
	{
		CRect Rect;
		GetWindowRect(&Rect);
		CWnd *pParent = GetParent();
		ASSERT(pParent);
		pParent->ScreenToClient(&Rect);  //convert our corrdinates to our parents

		//copy what's on the parents at this point
		CDC *pDC = pParent->GetDC();
		CDC MemDC;
		MemDC.CreateCompatibleDC(pDC);
		m_Bmp.CreateCompatibleBitmap(pDC, Rect.Width(), Rect.Height());
		CBitmap *pOldBmp = MemDC.SelectObject(&m_Bmp);
		MemDC.BitBlt(0, 0, Rect.Width(), Rect.Height(), pDC, Rect.left, Rect.top, SRCCOPY);
		MemDC.SelectObject(pOldBmp);
		pParent->ReleaseDC(pDC);
	}
	else //copy what we copied off the parent the first time back onto the parent
	{
		CRect Rect;
		GetClientRect(Rect);
		CDC MemDC;
		MemDC.CreateCompatibleDC(pDC);
		CBitmap *pOldBmp = MemDC.SelectObject(&m_Bmp);
		pDC->BitBlt(0, 0, Rect.Width(), Rect.Height(), &MemDC, 0, 0, SRCCOPY);
		MemDC.SelectObject(pOldBmp);
	}

	return TRUE;
}
开发者ID:13CLC,项目名称:NMCNPM,代码行数:33,代码来源:CommandButton.cpp

示例5: OnDraw

void CUIDesignerView::OnDraw(CDC* pDrawDC)
{
	CUIDesignerDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: 在此处为本机数据添加绘制代码
	CMemDC memDC(*pDrawDC, this);
	CDC* pDC = &memDC.GetDC();

	CRect rectClient;
	GetClientRect(rectClient);
	CPoint point=GetScrollPosition();
	rectClient.OffsetRect(point);
	pDC->FillSolidRect(rectClient,RGB(255, 255, 255));

	CSize szForm=m_LayoutManager.GetForm()->GetInitSize();
	CSize szFormOffset(FORM_OFFSET_X,FORM_OFFSET_Y);
	CDC hCloneDC;
	HBITMAP hNewBitmap;
	hCloneDC.CreateCompatibleDC(pDC);
	hNewBitmap=::CreateCompatibleBitmap(pDC->GetSafeHdc(),szForm.cx,szForm.cy);
	HBITMAP hOldBitmap=(HBITMAP)hCloneDC.SelectObject(hNewBitmap);
	m_LayoutManager.Draw(&hCloneDC);
	pDC->BitBlt(szFormOffset.cx,szFormOffset.cy,szForm.cx,szForm.cy,&hCloneDC,0,0,SRCCOPY);
	hCloneDC.SelectObject(hOldBitmap);
	::DeleteDC(hCloneDC);
	::DeleteObject(hNewBitmap);

	m_MultiTracker.Draw(pDC,&szFormOffset);
}
开发者ID:csuhuangcheng,项目名称:duilib,代码行数:32,代码来源:UIDesignerView.cpp

示例6: Capture

void CViewBitmap::Capture(CRect &rect)
{ 
 if(m_pPalette)
 { DeleteObject();
   delete m_pPalette;
 }
 m_width=rect.Width();
 m_heighth=rect.Height();
 double wid=rect.left/1024;
 double hei=rect.top/768;

 CDC dcscreen;
 dcscreen.CreateDC("DISPLAY",NULL,NULL,NULL);
 CDC dcMem;
 dcMem.CreateCompatibleDC( &dcscreen );
 CreateCompatibleBitmap( &dcscreen, m_width, m_heighth );
 dcMem.SelectObject( this );

 dcMem.BitBlt(0,0,m_width, m_heighth,&dcscreen,rect.left,rect.top,SRCCOPY);
// create an empty logical palette that¡¯s big enough to hold all the colors
 int nColors = ( 1 << ( dcscreen.GetDeviceCaps( BITSPIXEL ) *dcscreen.GetDeviceCaps( PLANES ) ) );
 LOGPALETTE *pLogpal=(LOGPALETTE*) new BYTE[sizeof(LOGPALETTE)+(nColors * sizeof(PALETTEENTRY))];
 pLogpal -> palVersion = 0x300;
 pLogpal -> palNumEntries = nColors;
// load this empty palette with the system palette's colors
 GetSystemPaletteEntries( dcscreen.m_hDC, 0, nColors,(LPPALETTEENTRY)(pLogpal->palPalEntry));
 m_pPalette = new CPalette;
 m_pPalette -> CreatePalette( pLogpal );
 delete []pLogpal;
 dcMem.DeleteDC();
 dcscreen.DeleteDC();
}
开发者ID:JetC,项目名称:DigitalMap,代码行数:32,代码来源:ViewBitmap.cpp

示例7: OnNcPaint

void CSkinListBox::OnNcPaint()
{
	//如果资源没有就是不想绘制边框了
	if ( m_pBackImgN == NULL ) 
	{
		__super::OnNcPaint();
		return;
	}

	CRect rcWindow;
	GetWindowRect(&rcWindow);

	CRect rcClient;
	GetClientRect(&rcClient);

	ClientToScreen(&rcClient);
	rcClient.OffsetRect(-rcWindow.left, -rcWindow.top);

	rcWindow.OffsetRect(-rcWindow.left, -rcWindow.top);

	CDC *pWindowDC = GetWindowDC();
	CMemoryDC MemDC(pWindowDC,rcWindow);

	DrawParentWndBg(GetSafeHwnd(),MemDC.GetSafeHdc());

	if (m_pBackImgN != NULL && !m_pBackImgN->IsNull())
		m_pBackImgN->Draw(&MemDC, rcWindow);
	
	pWindowDC->BitBlt(rcWindow.left,rcWindow.top,rcWindow.Width(),rcWindow.Height(),&MemDC,0,0,SRCCOPY);

	ReleaseDC(pWindowDC);
}
开发者ID:Arthurshen98,项目名称:EasyPlayer,代码行数:32,代码来源:SkinListBox.cpp

示例8: OnPaint

void CInstrumentGraph::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: 在此处添加消息处理程序代码
	// 不为绘图消息调用 CWnd::OnPaint()
	CDC memDC ;
	CBitmap memBitmap ;
	CBitmap* oldBitmap ; // bitmap originally found in CMemDC

	// no real plotting work is performed here, 
	// just putting the existing bitmaps on the client

	// to avoid flicker, establish a memory dc, draw to it 
	// and then BitBlt it to the client
	if (m_bDrawUnit == true)
	{
		return;
	}
	memDC.CreateCompatibleDC(&dc) ;
	memBitmap.CreateCompatibleBitmap(&dc, m_rectClient.Width() - m_iVScrBarInterval, m_rectClient.Height() - m_iHScrBarInterval) ;
	oldBitmap = (CBitmap *)memDC.SelectObject(&memBitmap) ;

	if (memDC.GetSafeHdc() != NULL)
	{
		// first drop the grid on the memory dc
		memDC.BitBlt(0, 0, m_rectClient.Width() - m_iVScrBarInterval, m_rectClient.Height() - m_iHScrBarInterval, 
			&m_dcGraph, m_iHScrPos - m_iLeftMovePos, 0, SRCCOPY) ;
		// finally send the result to the display
		dc.BitBlt(0, 0, m_rectClient.Width() - m_iVScrBarInterval, m_rectClient.Height() - m_iHScrBarInterval, 
			&memDC, 0, 0, SRCCOPY) ;
	}
	memDC.SelectObject(oldBitmap) ;
}
开发者ID:liquanhai,项目名称:cxm-hitech-matrix428,代码行数:33,代码来源:InstrumentGraph.cpp

示例9: OnPaint

void CSignalView::OnPaint()
{
    //CPaintDC dc(this); // device context for painting
    GetClientRect(&m_SignalRect);

    if(!m_bUpdateLocal)
    {
        CDC *pDC = GetDC();
        CDC MemDC;
        MemDC.CreateCompatibleDC(NULL);
        CBitmap Memmap;
        Memmap.CreateCompatibleBitmap(pDC , m_SignalRect.Width(),m_SignalRect.Height());
        CBitmap *pOldMap = MemDC.SelectObject(&Memmap);
        ReDrawmap(&MemDC);
        pDC->BitBlt(0,0,m_SignalRect.Width(),m_SignalRect.Height(),&MemDC,0,0,SRCCOPY);
        ReleaseDC(pDC);
        MemDC.SelectObject(pOldMap);
        Memmap.DeleteObject();
        MemDC.DeleteDC();
        m_bUpdateLocal = false;
    }
    else
    {
        CDC *pDC = GetDC();
        if (pDC != NULL)
        {
            DrawMap(pDC, m_NewSignalData.GetData(), m_NewSignalData.GetDataSize());
            ReleaseDC(pDC);
        }
        else
            ReleaseDC(pDC);
        m_bUpdateLocal = TRUE;
    }
    CWnd::OnPaint();
}
开发者ID:SproutOrc,项目名称:BiteProc,代码行数:35,代码来源:SignalView.cpp

示例10: OnPaint

void COBDPNDDlgData::OnPaint()
{
	if (m_dwBkResID !=NULL && m_memdcBkBmp != NULL)
	{
		CClientDC pDC(this);

		CRect rect; 
		CDC   memDC; 

		GetWindowRect(&rect); 	
		memDC.CreateCompatibleDC(&pDC); 	

		CBitmap* pOldMemBmp = NULL; 
		pOldMemBmp = memDC.SelectObject(&m_cBitmapBkBmp);
		memDC.BitBlt(0,0,rect.Width(),rect.Height(),&m_memdcBkBmp,0,0,SRCCOPY);

		memDC.SetBkMode(TRANSPARENT);	
		memDC.SetTextColor(theMainDlg->m_clrTitle);

		//将背景位图复制到窗口客户区 
		pDC.BitBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,SRCCOPY); 

		if(pOldMemBmp)   
			memDC.SelectObject(pOldMemBmp); 

		DeleteObject(pOldMemBmp);	
		DeleteDC(memDC);

	}
	CDialog::OnPaint();
}
开发者ID:Aavesh,项目名称:obd_pnd,代码行数:31,代码来源:OBDPNDDlgData.cpp

示例11: DrawItem

//界面绘画函数
void CButtonEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	//定义变量
	CRect rcClient;
	GetClientRect(&rcClient);
	bool bDisable=((lpDrawItemStruct->itemState&ODS_DISABLED)!=0);
	bool bButtonDown=((lpDrawItemStruct->itemState&ODS_SELECTED)!=0);

	CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

	//获取文字
	CString strText;
	GetWindowText(strText);
	
	//绘制父窗口背景
	CRect rcWindow;
	CClientDC clDC(GetParent());

	GetWindowRect(rcWindow);
	GetParent()->ScreenToClient(rcWindow);

	CDC dcParent;
	CBitmap bmp,*pOldBitmap;
	dcParent.CreateCompatibleDC(&clDC);
	bmp.CreateCompatibleBitmap(&clDC,rcClient.Width(),rcClient.Height());
	pOldBitmap = dcParent.SelectObject(&bmp);
	dcParent.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&clDC,rcWindow.left,rcWindow.top,SRCCOPY);
	bmp.DeleteObject();

	//加载背景图
	if ( !m_ImageBack.IsNull() )
	{
		//计算位图位置
		int nWidth=m_ImageBack.GetWidth()/4,nDrawPos=0;
		if (bDisable) nDrawPos=nWidth*3;
		else if (bButtonDown) nDrawPos=nWidth*2;
		else if (m_bHovering) nDrawPos=nWidth*1;

		//绘画背景图
		if (m_bExpand==false) m_ImageBack.DrawImage(pDC,0,0,rcClient.Width(),rcClient.Height(),nDrawPos,0);
		else m_ImageBack.DrawImage(pDC,0,0,rcClient.Width(),rcClient.Height(),nDrawPos,0,nWidth,m_ImageBack.GetHeight());
	}
	else
	{
		//绘画默认界面
		pDC->FillSolidRect(&rcClient,GetSysColor(COLOR_BTNFACE));
		if (bButtonDown) pDC->Draw3dRect(&rcClient,GetSysColor(COLOR_WINDOWFRAME),GetSysColor(COLOR_3DHILIGHT));
		else pDC->Draw3dRect(&rcClient,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_WINDOWFRAME));
	}

	//绘画字体
	rcClient.top+=1;
	pDC->SetBkMode(TRANSPARENT);
	if (bDisable) pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));
	else pDC->SetTextColor(m_crTextColor);
	pDC->DrawText(strText,strText.GetLength(),rcClient,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

	return;
}
开发者ID:HuugY,项目名称:MFC_Project,代码行数:60,代码来源:ButtonEx.cpp

示例12: PaintCaption

void CPanelWnd::PaintCaption(CDC& dc)
{
	CString strCaption;
	CRect rc, rcWnd;

	GetWindowRect( &rcWnd );
	rc.SetRect( 0, 0, rcWnd.Width(), CAPTION_HEIGHT );
	GetWindowText( strCaption );

	CDC* pBuffer = CoolInterface.GetBuffer( dc, rc.Size() );

	if ( ! CoolInterface.DrawWatermark( pBuffer, &rc, &Skin.m_bmPanelMark, 0, 0 ) )
	{
		pBuffer->FillSolidRect( &rc, Skin.m_crPanelBack );
	}

	int nIconY = rc.Height() / 2 - 8;
	DrawIconEx( pBuffer->GetSafeHdc(), 4, nIconY,
		GetIcon( FALSE ), 16, 16, 0, NULL, DI_NORMAL );

	CFont* pOldFont	= (CFont*)pBuffer->SelectObject( &CoolInterface.m_fntCaption );
	CSize szCaption	= pBuffer->GetTextExtent( strCaption );

	pBuffer->SetBkMode( TRANSPARENT );

	if ( Skin.m_crPanelBorder != CLR_NONE )
	{
		pBuffer->SetTextColor( Skin.m_crPanelBorder );
		pBuffer->ExtTextOut( 8 + 16 - 1, rc.Height() / 2 - szCaption.cy / 2 - 1,
			ETO_CLIPPED, &rc, strCaption, NULL );
		pBuffer->ExtTextOut( 8 + 16 + 1, rc.Height() / 2 - szCaption.cy / 2 - 1,
			ETO_CLIPPED, &rc, strCaption, NULL );
		pBuffer->ExtTextOut( 8 + 16, rc.Height() / 2 - szCaption.cy / 2 - 1 - 1,
			ETO_CLIPPED, &rc, strCaption, NULL );
		pBuffer->ExtTextOut( 8 + 16, rc.Height() / 2 - szCaption.cy / 2 - 1 + 1,
			ETO_CLIPPED, &rc, strCaption, NULL );
	}

	pBuffer->SetTextColor( Skin.m_crPanelText );
	pBuffer->ExtTextOut( 8 + 16, rc.Height() / 2 - szCaption.cy / 2 - 1,
		ETO_CLIPPED, &rc, strCaption, NULL );

	if ( m_bPanelClose )
	{
		pBuffer->SelectObject( &theApp.m_gdiFont );
		CString strText	= _T("Close");
		CSize szText	= pBuffer->GetTextExtent( strText );

		m_rcClose.SetRect( rc.right - szText.cx - 8, rc.top, rc.right, rc.bottom );
		pBuffer->ExtTextOut( m_rcClose.left + 2,
			( m_rcClose.top + m_rcClose.bottom ) / 2 - szText.cy / 2 - 1,
			ETO_CLIPPED, &m_rcClose, strText, NULL );
		m_rcClose.OffsetRect( rcWnd.left, rcWnd.top );
	}

	pBuffer->SelectObject( pOldFont );

	dc.BitBlt( rc.left, rc.top, rc.Width(), rc.Height(), pBuffer, 0, 0, SRCCOPY );
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:59,代码来源:WndPanel.cpp

示例13: Draw

void ToppyFramework::Draw(CDC* pDC)
{
	CDC* pMemDC = GetDC();


	if (NeedsRepaint())
	{
		m_TheState.Draw(pMemDC);

		CDC osdDC;
		osdDC.CreateCompatibleDC(pDC);
		osdDC.SetBkColor(TRANSPARENT_COLOUR);
		CBitmap bmOsd;
		bmOsd.CreateCompatibleBitmap(pDC, 720, 576);
		osdDC.SelectObject(&bmOsd);
		osdDC.FillSolidRect(0,0,720,576,TRANSPARENT_COLOUR);
		if (m_OSDregions.Draw(&osdDC))
		{
			CDC monoDC;
			monoDC.CreateCompatibleDC(pDC);
			CBitmap maskBm;
			maskBm.CreateBitmap(720, 576, 1, 1, NULL);
			monoDC.SelectObject(maskBm);
			osdDC.SetBkColor(TRANSPARENT_COLOUR);
			monoDC.BitBlt(0, 0, 720, 576, &osdDC, 0, 0, SRCCOPY);

			CDC tempDC;
			tempDC.CreateCompatibleDC(pDC);
			CBitmap tempBM;
			tempBM.CreateCompatibleBitmap(pDC, 720, 576);
			tempDC.SelectObject(&tempBM);
			tempDC.BitBlt(0,0, 720, 576, pMemDC, 0, 0, SRCCOPY);

			BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255-(BYTE)(GetConfig()->GetOsdTransparency() * 255/100), 0};
			pMemDC->AlphaBlend(0, 0, 720, 576, &osdDC, 0, 0, 720, 576, bf );
	//
	////		 now contains correct over OSD area, wrong in background
	//
			pMemDC->MaskBlt(0,0, 720, 576, &tempDC, 0, 0, maskBm, 0, 0, MAKEROP4(SRCCOPY, DSTCOPY));
			//memDC.BitBlt(0, 0, 720, 576, &osdDC, 0, 0, SRCCOPY);
		}
	}

	pDC->BitBlt(0,0, 720, 576, pMemDC, 0, 0, SRCCOPY); 
	ReleaseDC();
}
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:46,代码来源:ToppyFramework.cpp

示例14: DrawItem

void CIconButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
	CRect rectItem = lpDrawItemStruct->rcItem;

	// set up for double buffering
	CDC dcMem;
	dcMem.CreateCompatibleDC(pDC);
	CBitmap bmp;
	bmp.CreateCompatibleBitmap(pDC, rectItem.Width(), rectItem.Height());
	CBitmap *pOldBitmap = dcMem.SelectObject(&bmp);
	dcMem.SetBkMode(TRANSPARENT);

	DrawBackGround(&dcMem);

	// button state
	BOOL bDrawFocusRect = !(lpDrawItemStruct->itemState & ODS_NOFOCUSRECT);
	BOOL bIsFocused     = lpDrawItemStruct->itemState & ODS_FOCUS;
	BOOL bIsPressed		= lpDrawItemStruct->itemState & ODS_SELECTED;

	DWORD state = bIsPressed ? PBS_PRESSED : PBS_NORMAL;

	if (state == PBS_NORMAL)
	{
		if (m_bhover)
		{
			state = PBS_HOT;
		}
	}

	if(bIsPressed)
	{
		dcMem.FillSolidRect(&rectItem, RGB(0, 0, 155));
	}
	else if(bIsFocused)
	{
		dcMem.FillSolidRect(&rectItem, RGB(0, 155, 0));
	}


	if(m_hIcon)
	{
		DrawIcon(&dcMem, rectItem);
	}
	else if(m_bitmap.GetSafeHandle())
	{
		DrawBitmap(&dcMem, rectItem);
	}

	// end double buffering
	pDC->BitBlt(0, 0, rectItem.Width(), rectItem.Height(),
		&dcMem, 0, 0, SRCCOPY);

	// swap back the original bitmap
	dcMem.SelectObject(pOldBitmap);
	bmp.DeleteObject();
	dcMem.DeleteDC();
}
开发者ID:lilingshui,项目名称:code-refrence,代码行数:58,代码来源:IconButton.cpp

示例15: OnPaint

void CSkinTab::OnPaint()
{
	int i = 0;
	CPaintDC dc(this); // device context for painting
	// TODO: 在此处添加消息处理程序代码
	CRect r;
	GetClientRect(&r);	

	CDC memDC;
	memDC.CreateCompatibleDC(&dc);
	CBitmap btScreen;
	btScreen.CreateCompatibleBitmap(&dc, r.Width(), r.Height());
	memDC.SelectObject(&btScreen);
	btScreen.DeleteObject();

	//画背景 
	memDC.BitBlt(r.left, r.top, r.Width(), r.Height(), &m_memDC, 0, 0, SRCCOPY);

	//memDC.Rectangle(r);
	for( i=0;i<m_nTabCount;i++)
	{
		CRect rect=m_pTabRect[m_nTabCount-i-1];
		
		rect.top +=22;
		DrawRangeImage(&m_BitmapBack[0],&memDC,rect);

	}
	if(m_nCurDownIndex!=-1)
	{
		CRect rect=m_pTabRect[m_nCurDownIndex];
		DrawRangeImage(&m_BitmapBack[1],&memDC,rect);

	
	}

	for(i = 0; i < MAX_TEXT_COUNT;i++)
	{
		if(strlen(m_TextTitle[i]) > 0)
		{
			CRect rect=m_pTabRect[i];
			CSize sizeTemp=memDC.GetTextExtent(m_TextTitle[i],_tcslen(m_TextTitle[i]));
			int xPos = (rect.Width() - sizeTemp.cx )/ 2 + rect.left;
			int YPos = (rect.Height() - sizeTemp.cy )/ 2 + rect.top + 11 ;
			if(xPos < 0)
				xPos = rect.left + 2;
			if(YPos < 0)
				YPos = rect.top + 2;
			memDC.SetBkMode(TRANSPARENT);
			memDC.TextOut(xPos ,YPos,m_TextTitle[i]);
		}
	}

	dc.BitBlt(r.left, r.top, r.Width(), r.Height(), &memDC, 0, 0, SRCCOPY);

	memDC.DeleteDC();
	// 不为绘图消息调用 CStatic::OnPaint()
}
开发者ID:cugxiangzhenwei,项目名称:MySrcCode,代码行数:57,代码来源:SkinTab.cpp


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