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


C++ CBrush类代码示例

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


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

示例1: GetClientRect

BOOL CPictureWnd::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CRect rt;
	GetClientRect(&rt);
	CBrush br;
	br.CreateSolidBrush(PICTURE_BACK_COLOR);
	pDC->FillRect(&rt,&br);

	return TRUE;
//	return CWnd::OnEraseBkgnd(pDC);
}
开发者ID:mk-z,项目名称:Scan,代码行数:12,代码来源:PictureWnd.cpp

示例2: OnEraseBkgnd

BOOL CGuiDockToolBarEx::OnEraseBkgnd(CDC* pDC)
{
    // TODO: Add your message handler code here and/or call default

    CBrush cbr;
    cbr.CreateSolidBrush(GuiDrawLayer::GetRGBColorFace(GuiDrawLayer::m_Style));
    CRect m_rect;
    GetClientRect(m_rect);
    pDC->FillRect(m_rect,&cbr);
    return TRUE;

}
开发者ID:ZhaoboMeng,项目名称:k-line-print,代码行数:12,代码来源:GuiDockToolBarEx.cpp

示例3: GetClientRect

BOOL CScreenPannel::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CRect rt;
	GetClientRect(&rt);
	CBrush br;
	br.CreateSolidBrush(RGB(192,192,192));
	pDC->FillRect(&rt,&br);

	return TRUE;
	return CWnd::OnEraseBkgnd(pDC);
}
开发者ID:dulton,项目名称:brpj,代码行数:12,代码来源:ScreenPannel.cpp

示例4: dc

void CHpsCtrl::DrawBkgd()
{
	CClientDC dc(this);
	CBrush brBkgd;
	int nOriginX = m_rcWindow.left + ORG_OFFSET;
	int nOriginY = m_rcWindow.bottom - ORG_OFFSET;
	
	brBkgd.CreateSolidBrush(m_clrBkgd);
	dc.FillRect(&m_rcWindow, &brBkgd);
	dc.Draw3dRect(&m_rcWindow, RGB(0x62, 0x6c, 0x68), RGB(0x62, 0x6c, 0x68));
	DrawCoordinate(&dc, nOriginX, nOriginY);
}
开发者ID:ningmenglive,项目名称:NineLine,代码行数:12,代码来源:HpsCtrl.cpp

示例5: dc

void CTestMFCDlg::OnPaint() 
{
	/*
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
	*/
	CPaintDC dc(this);
	CRect rect;
	CBitmap bmp;
	bmp.LoadBitmap(IDB_BITMAP3);
	BITMAP bmpinfo;
	bmp.GetBitmap(&bmpinfo);
	CDC cdc;
	cdc.CreateCompatibleDC(&dc);
	cdc.SelectObject(bmp);
	CBrush brush;
	brush.CreatePatternBrush(&bmp);

	//GetClientRect(rect);
	GetClientRect(rect);
	dc.StretchBlt(0,0,rect.right,rect.bottom,&cdc,0,0,bmpinfo.bmWidth,bmpinfo.bmHeight,SRCCOPY);
	//dc.FillRect(CRect(0,0,rect.right/2,rect.bottom/2),&brush);
	//dc.FillSolidRect(0,0,rect.right/2,rect.bottom/2,RGB(0,0,255));
	//dc.FillSolidRect(CRect(0,0,rect.right/2,rect.bottom/2),RGB(0,0,255));
	//CDialog::OnPaint();
	/*
	CDialog::OnInitDialog(); 
	CBitmap bmp; 
	bmp.LoadBitmap(IDB_BITMAP1); 
	CBrush brush;
	brush.CreatePatternBrush(&bmp); 
	bmp.DeleteObject(); 
	*/
}
开发者ID:YaMiYooo,项目名称:MFC-Examles,代码行数:53,代码来源:TestMFCDlg.cpp

示例6: GetClientRect

BOOL CPlayWnd::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CWnd::OnEraseBkgnd(pDC);

	CRect rect;
	GetClientRect(&rect);
	CBrush brush;
	brush.CreateSolidBrush(VIDEO_BACK_COLOR);
	pDC->FillRect(&rect, &brush);
	return TRUE;
}
开发者ID:dalinhuang,项目名称:demodemo,代码行数:12,代码来源:PlayWnd.cpp

示例7: dc

void IW::CRender::Play(HENHMETAFILE hemf)
{
	IW::CDCRender dc(*this);
	bool bHasPal = dc.GetDeviceCaps(BITSPIXEL) <= 8;

	// Create a logical palette from the colors in the color table
	UINT nColors = GetEnhMetaFilePaletteEntries(hemf, 0, NULL);
	CPalette pal;

	if (bHasPal && nColors != GDI_ERROR && nColors != 0)
	{
		bHasPal = false;
		DWORD dwSize = sizeof (LOGPALETTE) + ((nColors - 1) * sizeof (PALETTEENTRY));

		LPLOGPALETTE logPalette = IW_ALLOCA(LPLOGPALETTE, dwSize);

		logPalette->palVersion = 0x300;
		logPalette->palNumEntries = nColors;

		if (nColors == GetEnhMetaFilePaletteEntries(hemf, nColors, logPalette->palPalEntry))
		{
			pal.CreatePalette(logPalette);
		}
	}

	HPALETTE hOldPal = NULL;

	if (bHasPal)
	{
		hOldPal = dc.SelectPalette(pal, TRUE);
		dc.RealizePalette();
	}

	CRect rcClip = _pSurface->GetClipRect();

	int nHeightRender = rcClip.bottom - rcClip.top;
	int nWidthRender = rcClip.right - rcClip.left;

	CBrush brush;
	CRect r(0, 0, nWidthRender, nHeightRender);

	if (brush.CreateSolidBrush(RGB(255,255,255)))
	{		
		dc.FillRect(&r, brush);
	}

	PlayEnhMetaFile(dc, hemf, &r);
	::GdiFlush();

	if (hOldPal)
		dc.SelectPalette(hOldPal, FALSE);
}
开发者ID:ZacWalk,项目名称:ImageWalker,代码行数:52,代码来源:Render.cpp

示例8: dc

void COXTabViewContainer::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here

	CWnd* pWnd=GetActivePage();
	if(pWnd!=NULL)
	{
		CRect rect;
		pWnd->GetWindowRect(rect);
		ScreenToClient(rect);
		if(m_rectPage!=rect && !rect.IsRectEmpty())
		{
			CRgn rgnInTheory;
			CRgn rgnInReality;
			if(rgnInTheory.CreateRectRgnIndirect(m_rectPage) &&
				rgnInReality.CreateRectRgnIndirect(rect))
			{
				if(rgnInTheory.CombineRgn(&rgnInTheory,&rgnInReality,
					RGN_DIFF)!=ERROR)
				{
					CBrush* pBrush=NULL;
					CBrush brush;
					HBRUSH hBrush=(HBRUSH)(INT_PTR)::GetClassLongPtr(pWnd->m_hWnd,
						GCL_HBRBACKGROUND);
					if(hBrush==NULL)
					{
						if(brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOW)))
							pBrush=&brush;
						else
							pBrush=dc.GetCurrentBrush();
					}
					else
					{
						pBrush=CBrush::FromHandle(hBrush);
					}
					
					if(pBrush!=NULL)
						dc.FillRgn(&rgnInTheory,pBrush);
				}
			}
		}
	}

	DrawScrollButtons(&dc);
	DrawSplitter(&dc);
	DrawSizeBar(&dc);
	DrawTabBtnArea(&dc);

	// Do not call CWnd::OnPaint() for painting messages
}
开发者ID:leonwang9999,项目名称:testcode,代码行数:52,代码来源:OXTabView.cpp

示例9: OnEraseBkgnd

BOOL COscillogram::OnEraseBkgnd(CDC* pDC) 
{
	CRect rc;   
	CBrush brush;

	brush.CreateSolidBrush(m_bkColor);
	GetClientRect(&rc);
	
	pDC->FillRect(&rc, &brush);

	return TRUE;
	//return CWnd::OnEraseBkgnd(pDC);
}
开发者ID:marco-sun,项目名称:arbi6,代码行数:13,代码来源:Oscillogram.cpp

示例10: DrawTriggers

void CShape::DrawTriggers(CDC* pcDC)
{
	CBrush cBrush;
	cBrush.CreateSolidBrush(m_clrFrame);
	CBrush* pOldBrush = (CBrush*)pcDC->SelectObject(&cBrush);
	CRect* pArrTrigers = GetTriggers();

	int nLen = TRIGGER_COUNT;
	for (int i = 0; i < nLen; i++)
		pcDC->Rectangle(pArrTrigers[i]);

	pcDC->SelectObject(pOldBrush);
}
开发者ID:Eith45,项目名称:C__plusplus,代码行数:13,代码来源:CShape.cpp

示例11: dc

void CMyBalloon::OnPaint() 
{
	CPaintDC dc(this); 

	CRgn rgn; 
	rgn.CreateRectRgn (0,0,0,0);
	GetWindowRgn (rgn);
	
	CBrush brWnd; brWnd.CreateSolidBrush (m_pContent->getBkColor ());
	CBrush br1; br1.CreateSolidBrush (m_pContent->getTextColor ());
	dc.FillRgn (&rgn, &brWnd);
	dc.FrameRgn (&rgn, &br1, 1, 1);
}
开发者ID:HackLinux,项目名称:Free-Download-Manager-vs2010,代码行数:13,代码来源:MyBalloon.cpp

示例12: dcBuf

void CMenuSkin::DrawMenuNonClient(CDCHandle dc, const RECT &rect)
{
	CMemoryDC dcBuf(dc, rect);

	CPen pen;
	pen.CreatePen(PS_SOLID, 1, CSkinProperty::GetColor(Skin_Property_Menu_Border_Color));
	CBrush brush;
	brush.CreateSolidBrush(CSkinProperty::GetColor(Skin_Property_Menu_Background_Color));
	dcBuf.SelectPen(pen);
	dcBuf.SelectBrush(brush);

	dcBuf.Rectangle(&rect);
}
开发者ID:Williamzuckerberg,项目名称:chtmoneyhub,代码行数:13,代码来源:MenuSkin.cpp

示例13: dc

void CRightChgUserAccView::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: 在此处添加消息处理程序代码
	// 不为绘图消息调用 CDialog::OnPaint()
	CBitmap bitmap;
	bitmap.LoadBitmap(IDB_BIT_BKIN);
	CBrush Brush;
	Brush.CreatePatternBrush(&bitmap);
	CBrush* pOldBrush=dc.SelectObject(&Brush);
	dc.FillRect(CRect(0,0,783,659),&Brush);
	dc.SelectObject(pOldBrush);
}
开发者ID:shangdufeng,项目名称:ManangeClient,代码行数:13,代码来源:RightChgUserAccView.cpp

示例14: dc

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

	// TODO: Add your message handler code here
	CRect rectClient;
	GetClientRect(&rectClient);
	// If the current positionis  invalid then we should fade into the  background
	if (m_nCurrentPosition < m_nLower || m_nCurrentPosition > m_nUpper)
	{
		CRect rect;
		GetClientRect(rect);
		CBrush brush;
		brush.CreateSolidBrush(::GetSysColor(COLOR_3DFACE));
		dc.FillRect(&rect, &brush);
		VERIFY(brush.DeleteObject());
		return;
	}
	
	// The actions to take depend on whether or not we are a vertical control
	DWORD dwStyles = GetStyle();
	BOOL bVertical = (BOOL)(dwStyles & PBS_VERTICAL);
	
	
	// Figure out what part should be visible so we can stop the gradient when needed
	float maxWidth;
	if (bVertical)
		maxWidth = ((float)m_nCurrentPosition/(float)m_nUpper * (float)rectClient.bottom);		
	else
		maxWidth = ((float)m_nCurrentPosition/(float)m_nUpper * (float)rectClient.right);
	
	
	// Draw the gradient
		DrawGradient(&dc, rectClient, (int)maxWidth, bVertical);

	// Show percent indicator if needed
	if (m_bShowPercent)
	{
		CString strPercent;
		float fp = 100.0f; 
		fp *= (float)(m_nCurrentPosition-m_nLower); 
		fp /= (float)(m_nUpper-m_nLower); 
		strPercent.Format(_T("%ld/%ld"), m_nCurrentPosition, m_nUpper);
		
		dc.SetTextColor(m_clrText);
		dc.SetBkMode(TRANSPARENT);
		dc.DrawText(strPercent, &rectClient, DT_VCENTER |  DT_CENTER | DT_SINGLELINE);
	}

	// Do not call CProgressCtrl::OnPaint() for painting messages
}
开发者ID:timepp,项目名称:superword,代码行数:51,代码来源:GradientProgressCtrl.cpp

示例15: DrawItemCaption

void CGraphListCtrl::DrawItemCaption(IN CDC*    pDC,
									 IN CRect   rt,
									 IN CString strName,
									 IN BOOL    bSel)
{
	//     CBrush brushSel(RGB(0, 120, 240));
	//     CBrush brushNormal(RGB(166, 210, 255));
// 	CBrush brushSel(RGB(0, 60, 110)); //pk
// 	CBrush brushNormal(RGB(166, 210, 255));
	HBRUSH hOldBrush = NULL;
	CBrush bush;
	bush.CreateSolidBrush(m_colTextBk);
	hOldBrush = (HBRUSH)pDC-> SelectObject(&bush);//透明画刷
	// hOldBrush = (HBRUSH)pDC->SelectObject(brushSel);
	//pDC->SetTextColor(RGB(255, 255, 255)); //pk
	COLORREF colText = pDC->SetTextColor(GetTextColor());
	COLORREF colBk = pDC->SetBkColor(m_colTextBk);
	CFont* pFont = pDC->SelectObject(&m_font);

	CSize size = pDC->GetTextExtent(strName);
	//	rt.InflateRect(2,2);
	// pDC->Rectangle(&rt);//pk
	// 	rt.DeflateRect(2,2);
	//pDC->Draw3dRect(&rt, RGB(255, 255, 255), RGB(128, 128, 128)); 

// 	pDC->SetBkMode(TRANSPARENT);
	if(size.cx > rt.Width())
	{
		pDC->SetTextAlign(TA_LEFT);
// 		rt.DeflateRect(2, 2);
		pDC->IntersectClipRect(&rt);
		pDC->FillSolidRect(rt, m_colTextBk);
		pDC->TextOut(rt.left, rt.top, strName);

		CRgn rgn;
		CRect rtOld;
		GetClientRect(&rtOld);
		rgn.CreateRectRgn(rtOld.left, rtOld.top, rtOld.right, rtOld.bottom);
		pDC->SelectClipRgn(&rgn);
	} else
	{
		pDC->SetTextAlign(TA_CENTER);
		pDC->FillSolidRect(rt, m_colTextBk);
		pDC->TextOut(rt.left + rt.Width() / 2, rt.top+2, strName);
	}

	pDC->SelectObject(pFont);
	pDC->SetBkColor(colBk);
	pDC->SetTextColor(colText);
	pDC->SelectObject(hOldBrush);
}
开发者ID:kanbang,项目名称:SVN,代码行数:51,代码来源:GraphListCtrl.cpp


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