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


C++ CBrush::DeleteObject方法代码示例

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


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

示例1: DrawDialog

void CSet::DrawDialog()
{

	CDC *pDC=GetWindowDC();
	CBrush brush;
	CRect winRect;
	GetWindowRect(&winRect);
	CRect rect;
//底线
	rect.left =0;
	rect.right =winRect.Width  ();
	rect.top =winRect.Height ()-1;
	rect.bottom =winRect.Height ();
	brush.CreateSolidBrush (RGB(94,179,227));

	pDC->FillRect (&rect,&brush);

	brush.DeleteObject ();
//上线
	rect.left =0;
	rect.right =winRect.Width  ();
	rect.top =0;
	rect.bottom =1;
	brush.CreateSolidBrush (RGB(94,179,227));

	pDC->FillRect (&rect,&brush);

	brush.DeleteObject ();


//left线
	rect.left =0;
	rect.right =1;
	rect.top =0;
	rect.bottom =winRect.Height ();
	brush.CreateSolidBrush (RGB(94,179,227));

	pDC->FillRect (&rect,&brush);

	brush.DeleteObject ();

//right线
	rect.left =winRect.Width ()-1;
	rect.right =winRect.Width(),
	rect.top =0;
	rect.bottom =winRect.Height ();
	brush.CreateSolidBrush (RGB(94,179,227));

	pDC->FillRect (&rect,&brush);
	pDC->DeleteDC ();
	brush.DeleteObject ();	
}
开发者ID:ActNotSign,项目名称:bearbearvideo,代码行数:52,代码来源:Set.cpp

示例2: doThread

void CrainDlg::doThread()//由线程执行的方法
{
	CBrush aBrush;//画笔,主要用来填充颜色
	CPen aPen;//钢笔,主要用来画线条
	CRect aRect;//矩形,
	CWnd * pWind=GetDlgItem(IDC_PIC);//获取画图框资源
	CDC* pDC=pWind->GetDC();//画布
	struct dropletchain *pRain;//用来读取雨点链表
	while(1)
	{
		//画背景
		aBrush.CreateSolidBrush(RGB(0,0,0));//设置画笔的颜色,即天空的颜色
		pWind->GetClientRect(&aRect);//获取画布大小
		aRect.bottom-=DEFAULT_BOTTOM_HEIGHT;//修改底部的高度,底部向上为天空
		pDC->FillRect(aRect,&aBrush);//绘制上方天空
		aBrush.DeleteObject();//用完画笔删除
		aBrush.CreateSolidBrush(RGB(9,128,104));//设置池塘的颜色
		aRect.top+=aRect.Height();//顶部下移
		aRect.bottom+=DEFAULT_BOTTOM_HEIGHT;//底部高度下移
		pDC->FillRect(aRect,&aBrush);//绘制下方池塘
		aBrush.DeleteObject();//删除画笔
		pDC->SelectStockObject(NULL_BRUSH);//把DC设置成空心画笔,在画涟漪时可以画出空心椭圆
		pRain=pDropletchain;//把指针移向链表头
		while(pRain)
		{
			aPen.CreatePen(PS_SOLID,pRain->data->thick,pRain->data->color);//创建钢笔
			pDC->SelectObject(&aPen);//用这个钢笔来画画
			if(pRain->data->y>aRect.top)//若雨点到达池塘顶部
			{
				//画涟漪
				pDC->Ellipse(pRain->data->x-pRain->data->radius-ELLIPSE,pRain->data->y-pRain->data->radius,pRain->data->x+pRain->data->radius+ELLIPSE,pRain->data->y+pRain->data->radius);//画出椭圆
				pRain->data->radius++;//涟漪椭圆半径增大
				if(pRain->data->radius>pRain->data->len||pRain->data->x+pRain->data->radius+ELLIPSE>=aRect.Width())
					initDroplet(pRain->data);//如果雨点半径大于雨点长度则重新生成雨点
			}
			else
			{
				//画雨点
				pDC->MoveTo(pRain->data->x,pRain->data->y);//把画笔移动到指定的坐标
				pDC->LineTo(pRain->data->x+(int)pRain->data->len*sin(pRain->data->angle),pRain->data->y+(int)pRain->data->len*cos(pRain->data->angle));//根据角度和长度绘制出斜线
				pRain->data->x+=pRain->data->speed;pRain->data->y+=pRain->data->speed;//雨点的坐标增大,增大幅度为各自的speed
				if(pRain->data->x+(int)pRain->data->len*sin(pRain->data->angle)>=aRect.Width()-pRain->data->thick)
					initDroplet(pRain->data);//如果超出右侧界限则重新生成雨点
			}
			aPen.DeleteObject();//删除钢笔
			pRain=pRain->next;//
		}
		Sleep(100-m_slider.GetPos());//在死循环中休眠线程,形成动画效果
	}
	pDC->ReleaseOutputDC();//释放DC资源
}
开发者ID:Hilary-Zhang,项目名称:Data-Structure,代码行数:51,代码来源:rainDlg.cpp

示例3: DrawGradient

void CGradientProgressCtrl::DrawGradient(CPaintDC *pDC, const RECT &rectClient, const int &nMaxWidth)
{
	RECT	rectFill;		//显示区域
	float	fStep;			//每一步的幅宽
	CBrush	brush;			//显示的颜色画刷
	CMemDC1	memDC(pDC);	

	int		r,g,b;
	float	rStep,gStep,bStep;
	//得到不同颜色并相减,返回颜色之间的最大差值
	r=(GetRValue(m_clrEnd)-GetRValue(m_clrStart));
	g=(GetGValue(m_clrEnd)-GetGValue(m_clrStart));
	b=(GetBValue(m_clrEnd)-GetBValue(m_clrStart));
	//使进程条显示的总数 等于最大的颜色差值
	int		nSteps=max(abs(r),max(abs(g),abs(b)));
	//确定每一颜色填充多大的矩形区域
	fStep=(float)rectClient.right/(float)nSteps;
	//设置每一颜色填充的步数
	rStep=r/(float)nSteps;
	gStep=g/(float)nSteps;
	bStep=b/(float)nSteps;

	r=GetRValue(m_clrStart);
	g=GetGValue(m_clrStart);
	b=GetBValue(m_clrStart);
	//绘制颜色渐变的进程条
	for(int iOnBand=0;iOnBand<nSteps;iOnBand++)
	{
		::SetRect(&rectFill,
			//以下为填充矩形区域的左上角x,y和右下角x,y
							(int)(iOnBand*fStep),
							0,
							(int)((iOnBand+1)*fStep),
							rectClient.bottom);
		
		VERIFY(brush.CreateSolidBrush(RGB(r+rStep*iOnBand,g+gStep*iOnBand,b+bStep*iOnBand)));
		memDC.FillRect(&rectFill,&brush);
		VERIFY(brush.DeleteObject());
		//在结束绘制之前,使用背景色填充乘下的的客户区域
		if(rectFill.right>nMaxWidth)
		{
			::SetRect(&rectFill,rectFill.right,0,rectClient.right,rectClient.bottom);
			VERIFY(brush.CreateSolidBrush(m_clrBkGround));
			memDC.FillRect(&rectFill,&brush);
			VERIFY(brush.DeleteObject());
			return;
		}
	}
}
开发者ID:anyboo,项目名称:project,代码行数:49,代码来源:GradientProgressCtrl.cpp

示例4: DrawChess

/* 画棋子 */
void Chess::DrawChess(CDC *pDC)
{
    CBrush *brush;
    COLORREF color;
    CPen pen;
    int a, b;

    a = x - SIZE / 2;
    b = y - SIZE / 2;

    /* 选择颜色 */
    if (this->color == WHITE)	/* 白色 */
    {
        color = RGB(255, 255, 255);
        pen.CreatePen(PS_SOLID, 1, color);
    }
    else	/* 黑色 */
    {
        color = RGB(0, 0, 0);
        pen.CreatePen(PS_SOLID, 1, color);
    }

    brush = new CBrush(color);	/* 笔的属性 */
    pDC->SelectObject(brush);			/* 使用这支笔 */
    pDC->SelectObject(&pen);
    pDC->Ellipse(a, b, a + size, b + size);	/* 画圆 */
    brush->DeleteObject();
    pen.DeleteObject();
}
开发者ID:chenpoyang,项目名称:fivechess,代码行数:30,代码来源:hess.cpp

示例5: OnPaint

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

	CPen Pen;
	Pen.CreatePen(PS_SOLID, 1, RGB(0,0,255));
	CPen *pOldPen;
	pOldPen = dc.SelectObject(&Pen);

	CBrush Brush;
	Brush.CreateSolidBrush(RGB(0,255,0));
	CBrush *pOldBrush = dc.SelectObject(&Brush);
	{
		dc.MoveTo(0,0);
		dc.LineTo(100,100);
		dc.Rectangle(100,100,200,200);
	}
	dc.SelectObject(pOldPen);
	dc.SelectObject(pOldBrush);
	
	Brush.DeleteObject();
	Pen.DeleteObject();
	
	if(dibData == NULL)
		return;

	 SetDIBitsToDevice(dc.m_hDC,
     0, 0, imageWidth, imageHeight,   
     0, 0, 0, imageHeight,            
     dstData, bitmapInfo, DIB_RGB_COLORS);	
}
开发者ID:MinAreum,项目名称:churros_areum,代码行数:31,代码来源:ChildView.cpp

示例6: MakeBitMap

void Process::MakeBitMap()
{
	CClientDC ClientDC(pDCShow->GetWindow());
	if(m_pResMap!=NULL) 
		delete m_pResMap;

	m_pResMap=new CBitmap();
	m_pResMap->CreateCompatibleBitmap(&ClientDC,m_nWndWidth,m_nWndHeight);

	CDC dc;
	dc.CreateCompatibleDC(&ClientDC);
	dc.SelectObject(m_pResMap);

	for(int i=0; i<m_nWndHeight; i++)
	for(int j=0; j<m_nWndWidth; j++)
	dc.SetPixelV(j,i,RGB(m_tResPixelArray[i][j].rgbRed,m_tResPixelArray[i][j].rgbGreen,m_tResPixelArray[i][j].rgbBlue));

	if(m_bFaceOK && m_bShowFace)
	{
		CBrush Pen;
		Pen.CreateSolidBrush(RGB(255,0,0));
		dc.FrameRect(m_rFaceRegion,&Pen);
	 	Pen.DeleteObject();
	}

	dc.DeleteDC();
	MyDraw();
}
开发者ID:fanyang88,项目名称:face-tracking,代码行数:28,代码来源:Process.cpp

示例7: OnPaint

void CEZSnakeCtrl::OnPaint() 
{
	PROC_TRACE;

	CPaintDC dc(this);
	CDC *pdc;
   pdc = &dc;
	CRect rect,rcLeft,rcRight,rcSnake;
	GetClientRect(&rect);

	rcLeft.CopyRect(&rect);
	rcRight.CopyRect(&rect);
	rcSnake.CopyRect(&rect); 

	float nTailpos=(float)m_nTail/(float)m_nMax*(float)rect.right;
	float nHeadpos=(float)m_nPos/(float)m_nMax*(float)rect.right;
	

	rcSnake.left=(long)(m_bReverse?nHeadpos:nTailpos);
	rcSnake.right=(long)(m_bReverse?nTailpos:nHeadpos);

	rcLeft.right=rcSnake.left;
	rcRight.left=rcSnake.right;

   DrawGradient(pdc,rcSnake);

	CBrush brush;
	VERIFY(brush.CreateSolidBrush(m_clrBk));
	pdc->FillRect(&rcLeft, &brush);
	pdc->FillRect(&rcRight,&brush);
	VERIFY(brush.DeleteObject());
	// Do not call CStatic::OnPaint() for painting messages
}
开发者ID:freegroup,项目名称:DigitalSimulator,代码行数:33,代码来源:SnakeStatic.cpp

示例8: OnPaint

void CGuiWorkTab::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CBrush cbr;
	CRect m_rectDraw;
	cbr.CreateSolidBrush(GuiDrawLayer::GetRGBColorXP());
	
	GetClientRect(m_rectCliente);
	m_rectTab = m_rectCliente;
	m_rectDraw = m_rectCliente;
	
	if (m_alnTab == ALN_BOTTOM)
		m_rectDraw.bottom = m_rectCliente.bottom- (m_sizeImag.cy + SPACE_TAB + 2);	
	
	CRect rc = m_rectDraw;
	rc.top += 1;
	rc.bottom = rc.top + 1;
	dc.Draw3dRect(rc, GuiDrawLayer::GetRGBColorFace(m_StyleDisplay), GuiDrawLayer::GetRGBColorFace(m_StyleDisplay));
	
	if (m_alnTab == ALN_BOTTOM)
	{
		m_rectCliente.bottom = m_rectCliente.bottom- (DEFAULT_FLAT);
		m_rectTab.top = m_rectCliente.bottom + 2;
	}
	cbr.DeleteObject();
	Drawtabs(&dc);
}
开发者ID:neil-yi,项目名称:ffsource,代码行数:27,代码来源:GuiWorkTab.cpp

示例9: GetBitmapFromImageList

BOOL COptionTreeItemImage::GetBitmapFromImageList(CDC *pDC, HICON hIcon, CBitmap &bmp)
{
    // Declare varaibles
    CDC dc;
    CBrush brush;

    dc.CreateCompatibleDC(pDC);
    bmp.CreateCompatibleBitmap(pDC, m_sImageSizes.cx, m_sImageSizes.cy);
    CBitmap* pOldBmp = dc.SelectObject(&bmp);
    brush.CreateSolidBrush(GetSysColor(COLOR_MENU));
    ::DrawIconEx(dc.GetSafeHdc(), 0, 0, hIcon, m_sImageSizes.cx, m_sImageSizes.cy, 0, (HBRUSH)brush,DI_NORMAL);

    // Restore
    dc.SelectObject(pOldBmp);

    // Delete
    if (brush.GetSafeHandle() != NULL)
    {
        brush.DeleteObject();
    }
    if (dc.GetSafeHdc() != NULL)
    {
        dc.DeleteDC();
    }

    // The icon is not longer needed
    DestroyIcon(hIcon);

    return TRUE;
}
开发者ID:gaopan461,项目名称:acoral,代码行数:30,代码来源:OptionTreeItemImage.cpp

示例10: OnPaint

BOOL CSplitter::OnPaint(HDC hDC)
{
	CPaintDC dc(GetSafeHwnd()); // device context for painting
	CBrush cbr;
	CRect rcClient;
	GetClientRect(&rcClient);
	cbr.CreateSolidBrush(clrBg);
	
	CGDI		MemDC;
	CBitmap		m_BitmapMemDC;
	MemDC.CreateCompatibleDC(dc.m_hDC);
	m_BitmapMemDC.CreateCompatibleBitmap(dc.m_hDC,rcClient.Width(),rcClient.Height());	
	
	CBitmap *m_bitmapOld=new CBitmap(MemDC.SelectObject(&m_BitmapMemDC));
	
	MemDC.FillRect(&rcClient,&cbr);
	DrawSplitter(m_rcSpplitter,m_rectLeft,m_rectRight,&MemDC);
	
	dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),MemDC.m_hDC,
		      rcClient.left,rcClient.top,SRCCOPY);
	MemDC.SelectObject(m_bitmapOld);
	m_BitmapMemDC.DeleteObject();
	MemDC.DeleteDC();
	cbr.DeleteObject();
	dc.DeleteDC();
	m_bitmapOld->DeleteObject();
	delete m_bitmapOld;
	return TRUE;
}
开发者ID:weimingtom,项目名称:swc,代码行数:29,代码来源:CSplitter.cpp

示例11: OnPaint

BOOL CWorkTab::OnPaint(HDC hDC)
{
	CPaintDC dc(this); // device context for painting
	CBrush cbr;
	CRect m_rectDraw;
	cbr.CreateSolidBrush(CDrawLayer::GetRGBColorXP());
	
	GetClientRect(m_rectCliente);
	m_rectTab = m_rectCliente;
	m_rectDraw = m_rectCliente;
	
	if (m_alnTab == ALN_BOTTOM)
		m_rectDraw.bottom = m_rectCliente.bottom- (theApp->m_WinMain->m_sizeImagDocks.cy + SPACE_TAB + 2);	
	
	CRect rc = m_rectDraw;
	rc.top += 1;
	rc.bottom = rc.top + 1;
	dc.Draw3dRect(rc, CDrawLayer::GetRGBColorFace(), CDrawLayer::GetRGBColorFace());
	
	if (m_alnTab == ALN_BOTTOM)
	{
		m_rectCliente.bottom = m_rectCliente.bottom- (DEFAULT_FLAT);
		m_rectTab.top = m_rectCliente.bottom + 2;
	}
	cbr.DeleteObject();
	Drawtabs(&dc);
	dc.DeleteDC();
	return TRUE;
}
开发者ID:axxapp,项目名称:winxgui,代码行数:29,代码来源:CWorkTab.cpp

示例12: Init

void CColorWnd::Init()
{
    int x, y;
    float H, L;
    CDC dcMem;
    CPaintDC dc(this);
    CBrush brush;
    CRect rect;
    if (colorGradiant.m_hObject != NULL)
        colorGradiant.DeleteObject();        // get rid of old bitmap

    dcMem.CreateCompatibleDC(&dc);
    GetClientRect(clientRect);
    clientSize = clientRect.Size();
    colorGradiant.CreateCompatibleBitmap(&dc, clientSize.cx, clientSize.cy);
    ASSERT(colorGradiant.m_hObject != NULL);

    CBitmap* pOldBitmap = dcMem.SelectObject(&colorGradiant);

    for (y = 0; y < clientSize.cy; y++)
        for (x = 0; x < clientSize.cx; x++) {
            H = ((float)x) * 360 / (clientSize.cx - 1);
            L = ((float)(clientSize.cy - 1) - y) / (clientSize.cy - 1);
            rect.SetRect(x, y, x + 1, y + 1);
            brush.CreateSolidBrush(HLS_To_RGB(H, L, 1));
            dcMem.FillRect(&rect, &brush);
            brush.DeleteObject();
        }
    dcMem.SelectObject(pOldBitmap);
    dcMem.DeleteDC();
}
开发者ID:oliriley,项目名称:PhantomController,代码行数:31,代码来源:Colorwnd.cpp

示例13: OnDrawItem

void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	if (nIDCtl != IDC_LIST2) {
		return;
	}

	int nItem = lpDrawItemStruct->itemID;
	CRect rcItem = lpDrawItemStruct->rcItem;

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

	CBrush b;
	if (!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
		b.CreateSolidBrush(0xf1dacc);
		pDC->FillRect(rcItem, &b);
		b.DeleteObject();
		b.CreateSolidBrush(0xc56a31);
		pDC->FrameRect(rcItem, &b);
	} else {
		b.CreateSysColorBrush(COLOR_WINDOW);
		pDC->FillRect(rcItem, &b);
	}

	CString str;
	pDC->SetTextColor(0);

	str = m_list.GetItemText(nItem, 0);
	pDC->TextOut(rcItem.left + 3, (rcItem.top + rcItem.bottom - pDC->GetTextExtent(str).cy) / 2, str);
	str = m_list.GetItemText(nItem, 1);

	if (!str.IsEmpty()) {
		pDC->TextOut(rcItem.right - pDC->GetTextExtent(str).cx - 3, (rcItem.top + rcItem.bottom - pDC->GetTextExtent(str).cy) / 2, str);
	}
}
开发者ID:Tphive,项目名称:mpc-be,代码行数:34,代码来源:FavoriteOrganizeDlg.cpp

示例14: DrawCell

void DlgPalette::DrawCell(CDC *pDC, long index)
{
	CRect rect;
	if (!GetCellRect(index, rect)) return;

	CBrush brush;
	
	if (m_editalpha){
		brush.CreateSolidBrush(RGB(m_pal[index].rgbReserved,
					 m_pal[index].rgbReserved ,
					 m_pal[index].rgbReserved ));
	}else{
		brush.CreateSolidBrush(RGB(m_pal[index].rgbRed ,
					 m_pal[index].rgbGreen ,
					 m_pal[index].rgbBlue ));
	}

	CPen   pen;
	if (index==m_selected)
		pen.CreatePen(PS_SOLID, 2, ::GetSysColor(COLOR_3DDKSHADOW));
	else
		pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));

	CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush);
	CPen*   pOldPen   = (CPen*)   pDC->SelectObject(&pen);

	// Draw the cell colour
	pDC->Rectangle(rect);

	// restore DC and cleanup
	pDC->SelectObject(pOldBrush);
	pDC->SelectObject(pOldPen);
	brush.DeleteObject();
	pen.DeleteObject();
}
开发者ID:axDev-toolchain,项目名称:benchmark,代码行数:35,代码来源:DlgPalette.cpp

示例15: SetBlockColor

void SliderBoth::SetBlockColor()
{
#if 1
	CClientDC dc(this);
	//CDC* pdc = this->GetDC();
	//CDC*dc = this->GetDC();
	CRect rc;
	GetClientRect(&rc);
	
	CreateCompatibleDC((HDC)&dc);


	int iNumTic=(pos.iMax-pos.iMin)/pos.iTick;
	const int iL=MARGIN_SLIDE;
	const int iR=rc.right-MARGIN_SLIDE;
	const double dbStep=(iR-iL)*1.0/iNumTic;
	double db=iL;



	CBrush brush;             
	//brush.CreateSolidBrush(RGB(200,100,255));  
	brush.CreateSolidBrush(RGB(165,196,211));   
	//CBrush * pOldBrush= dc.SelectObject (&brush);
	CBrush * pOldBrush= dc.SelectObject (&brush);//LSC


	double lval = pos.iL*dbStep;//左边滑块
	double rval = pos.iR*dbStep;//右边滑块

	int iM=iNumTic/2;
	int RectaParam1,RectaParam2 = rc.top+1,RectaParam3,RectaParam4 = rc.bottom-MARGIN_SLIDE*2;

	if (pos.iL>=iM)
	{
		RectaParam1 = (int)lval;//+MARGIN_SLIDE*2;
	}else 
	{
		RectaParam1 = (int)lval+MARGIN_SLIDE*2;
	}

	if (pos.iR <= iM)
	{
		RectaParam3 = (int)rval+12;

	}else
	{
		RectaParam3 = (int)rval+3;
	}

//	dc.Rectangle((int)lval+MARGIN_SLIDE*2,rc.top+1,(int)rval,rc.bottom-MARGIN_SLIDE*2); 
	dc.Rectangle(RectaParam1,RectaParam2,RectaParam3,RectaParam4);
	dc.SelectObject (pOldBrush);
	brush.DeleteObject();
#endif
}
开发者ID:ALEXLCC,项目名称:T3000_Building_Automation_System,代码行数:56,代码来源:SliderBoth.cpp


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