C++ CClientDC::Rectangle方法代码示例(c++cclientdc::rectangle方法的典型用法代码示例)

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


C++ CClientDC::Rectangle方法代码示例(c++cclientdc::rectangle方法的典型用法代码示例)

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

示例1: DrawCell

void CMainFrame::DrawCell (UINT col,UINT row,BOOL alive)
{
	CBrush* pBrush;
	CClientDC clientDC (this);
	CDC memDC;
	memDC.CreateCompatibleDC (&clientDC);
	memDC.SelectObject (m_pBitmap);

	if(alive)
		pBrush=new CBrush(RGB(255, 0, 0));
	else
	{	
		if (m_showdead)
			pBrush=new CBrush(RGB(200, 200, 200));
		else
			pBrush=new CBrush(RGB(255, 255, 255));
	}

	CBrush* pOldBrush1=memDC.SelectObject (pBrush);
	CBrush* pOldBrush2=clientDC.SelectObject (pBrush);

	UINT drawCol= col * SQUARESIZE + HOROFFSET;
	UINT drawRow= row * SQUARESIZE + VEROFFSET;

	memDC.Rectangle (drawCol,drawRow,drawCol+SQUARESIZE+1, drawRow+SQUARESIZE+1);
	clientDC.Rectangle (drawCol,drawRow,drawCol+SQUARESIZE+1, drawRow+SQUARESIZE+1);

	memDC.SelectObject (pOldBrush1);
	clientDC.SelectObject (pOldBrush2);

	delete pBrush;
}
开发者ID:BorisMomtchev,项目名称:ConwaysLife,代码行数:32,代码来源:mainfrm.cpp

示例2: draw

void CComputer::draw(CClientDC &dc)
{
	if (visible){
		if ((isAttacker)||(underAttack)){
			originalPen = dc.SelectObject(&redPen);
			dc.SetTextColor(red);
		}else{
			originalPen = dc.SelectObject(&bluePen);
			dc.SetTextColor(black);
		}
	}else{
		originalPen = dc.SelectObject(&whitePen);
		dc.SetTextColor(white);
	}


	originalFont = dc.SelectObject(&captionFont);
	dc.SetBkMode(TRANSPARENT);
	
	dc.Rectangle(x1,y1,x2,y2);
	if (textPosition == 0){//oben
		dc.TextOut(x1-4*borderWidth,y1-(borderWidth+captionTextSize),name);
	}else{//rechts unten
		dc.TextOut(x2+3*borderWidth,y2+borderWidth-captionTextSize,name);
	}
	
	drawDataText(dc);

	dc.SelectObject(&originalFont);
	dc.SelectObject(&originalPen);
}
开发者ID:flomar,项目名称:CrypTool-VS2015,代码行数:31,代码来源:Computer.cpp

示例3: draw

void CListSelector::draw(CClientDC &dc, int orgX, int orgY, int width, int height)
{
	
	
	list<CSelectorItem>::iterator iter;
	
	int y0 = orgY;
	int y1 = orgY;
	
	int x0 = orgX;
	int x1 = orgX + width;

	
	//dc.Rectangle(orgX,orgY,orgX + width,orgY + height);
	
	int size=this->itemList.size();

	//dc.LineTo(x1,y1);
	int count=9;
	int start=4;
	int isNeedBreak=FALSE;

	int j=0;

	for(int i= -4 + focusIndex ; 
		i<= 4 + focusIndex;
		i++)
	{

		y0 = orgY + (j)*40;
		y1 = y0 + 40;
		CRect rect2(x0, y0+1, x1, y1);
		dc.Rectangle(&rect2);

		if(i==focusIndex)
		{
			CBrush *p=new CBrush();
			p->CreateSolidBrush(RGB(200,0,000));
			dc.FillRect(&rect2,p);
			dc.SetTextColor(RGB(255,255,255));
			delete p;
		}else{
			dc.SetTextColor(RGB(0,0,0));
		}

		int index = 0;
		if(i<0){
			index = (size*0X100000 + i) % size  ;
		}else{
			index=i % size ;
		}

		CString str(itemList[ index  ].getValue().c_str());		
		dc.DrawText(str,&rect2,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
		j++;
	
	}	
	
}
开发者ID:philipgreat,项目名称:cplusplus-windows-test-apps,代码行数:59,代码来源:ListSelector.cpp

示例4: erase

void CPacket::erase(CClientDC &dc)
{
	originalPen = dc.SelectObject(&whitePen);
	
	dc.Rectangle(x1,y1,x2,y2);
	
	dc.MoveTo(x1,y1);
	dc.LineTo(x2,y2);
	dc.MoveTo(x1,y2);
	dc.LineTo(x2,y1);

	dc.SelectObject(&originalPen);
}
开发者ID:flomar,项目名称:CrypTool-VS2015,代码行数:13,代码来源:Packet.cpp

示例5: draw

void CPacket::draw(CClientDC &dc)
{
	if (visible||active){
		originalPen = dc.SelectObject(&blackPen);
	}else{
		originalPen = dc.SelectObject(&whitePen);
	}
	dc.Rectangle(x1,y1,x2,y2);
	
	dc.MoveTo(x1+1,y1+1);
	dc.LineTo(x2-1,y2-1);
	dc.MoveTo(x1+1,y2-1);
	dc.LineTo(x2-1,y1+1);

	dc.SelectObject(&originalPen);
}
开发者ID:flomar,项目名称:CrypTool-VS2015,代码行数:16,代码来源:Packet.cpp

示例6: OnPaint

void CStatusBarXP::OnPaint ()
{
    Default();

    CClientDC cDC (this);
    CPenDC pen (cDC, ::GetSysColor (COLOR_3DSHADOW));
    CRect rcItem;

    cDC.SelectObject (::GetStockObject (NULL_BRUSH));

    for ( int i = 0; i < m_nCount; i++ )
    {
        GetItemRect (i, rcItem);
        cDC.Rectangle (rcItem); 
    }
}
开发者ID:UIKit0,项目名称:IISxpress,代码行数:16,代码来源:StatusBarXP.cpp

示例7: OnPaint

void CMyStatusBar::OnPaint() 
{
	Default();

    CClientDC cDC (this);
	CPen pen(PS_SOLID, 1, ::GetSysColor (COLOR_3DSHADOW));
	HPEN oldPen = (HPEN)cDC.SelectObject(pen);

    CRect rcItem;

    cDC.SelectObject (::GetStockObject (NULL_BRUSH));

    for ( int i = 0; i < m_nCount; i++ )
    {
        GetItemRect (i, rcItem);
        cDC.Rectangle (rcItem); 
    }
	cDC.SelectObject (oldPen);
}
开发者ID:Quetzaloid,项目名称:LaserScanXXX,代码行数:19,代码来源:MyStatusBar.cpp

示例8: CPen

STDMETHODIMP CMyCom1::DrawOffset(unsigned long m_pDC, unsigned long m_pOffset, double m_Scale, unsigned long m_pGraphInfo, BOOL scale_flag, BOOL m_active_flag)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	CClientDC * pDC = (CClientDC*) m_pDC;
	GraphInfo * pGraphInfo;

	//设置
	if ( m_pGraphInfo != NULL )
	{
		pGraphInfo = (GraphInfo*)m_pGraphInfo;
		m_GraphInfo.SetGraphInfo(*pGraphInfo);
	}
	else
		pGraphInfo = &m_GraphInfo;
	
		
	//计算偏移量
	if ( m_pOffset != NULL )
	{
		CPoint * offset = (CPoint *)m_pOffset;
		OffsetRgn((unsigned long)offset);
	}

	//设置激活标志
	isActive = m_active_flag;

	double scale = 0;
	m_scale_flag = scale_flag;
	if ( m_scale_flag )
		scale = m_Scale;
	else
		scale = 1;

	CFont * sysFont = pDC->SelectObject(&(pGraphInfo->font));
	CPen * pen = new CPen( pGraphInfo->normal_penStyle, pGraphInfo->normal_linewidth, pGraphInfo->normal_linecolor );	//构造画笔
	CPen * sysPen = pDC->SelectObject(pen);
	CBrush * normalBrush = new CBrush( pGraphInfo->normal_regioncolor );	//普通显示的画刷
	CBrush * activeBrush = new CBrush( pGraphInfo->active_regioncolor );	//激活后的画刷
	CBrush * blackBrush = new CBrush( BLACKBRUSHCOLOR );
	
	CRgn outRgn;
	outRgn.CreateRectRgn(0, 0, 5, 5);
	CRect smallRect;
	
	//判断是否激活了,如果激活,添加outRect
	if ( isActive )	//激活
	{
		if ( m_scale_flag )	//如果是在modelview区域
		{
			//选中后,在外边画一个方框
			outRgn.CombineRgn(&upRgn, &downRgn, RGN_OR);
			outRgn.GetRgnBox(&outRect);
			outRect.InflateRect(5, 5);
			
			pDC->MoveTo(outRect.left, outRect.top);
			pDC->LineTo(outRect.right, outRect.top);
			pDC->LineTo(outRect.right, outRect.bottom);
			pDC->LineTo(outRect.left, outRect.bottom);
			pDC->LineTo(outRect.left, outRect.top);

			//画出upRgn, downRgn, 和连线
			//pDC->FillRgn(&upRgn, normalBrush);
			CRect upRect;
			upRgn.GetRgnBox(upRect);
			pDC->Rectangle(upRect);
			pDC->MoveTo(upPoints[2]);
			pDC->LineTo(upPoints[5]);

			pDC->MoveTo(topPoint);
			pDC->LineTo(bottomPoint);
			pDC->MoveTo(leftPoint);
			pDC->LineTo(rightPoint);
			pDC->FillRgn(&downRgn, normalBrush);

			inRect.SetRect(upPoints[0].x, upPoints[0].y, upPoints[2].x, upPoints[2].y);
			pDC->SetTextColor(pGraphInfo->textcolor);
			pDC->DrawText(m_name, inRect, TEXTOUTFOMAT);	//|DT_END_ELLIPSIS);
						
			//在矩形的角上,画四个小矩形,5*5象素
			smallRect.SetRect(outRect.left, outRect.top, outRect.left+5, outRect.top+5);
			pDC->FillRect(smallRect, blackBrush);
			smallRect.SetRect(outRect.right-5, outRect.top, outRect.right, outRect.top+5);
			pDC->FillRect(smallRect, blackBrush);
			smallRect.SetRect(outRect.right-5, outRect.bottom-5, outRect.right, outRect.bottom);
			pDC->FillRect(smallRect, blackBrush);
			smallRect.SetRect(outRect.left, outRect.bottom-5, outRect.left+5, outRect.bottom);
			pDC->FillRect(smallRect, blackBrush);
		}
		else	//如果是在comview区域
		{
			//选中后,在外边画一个方框
			downRgn.GetRgnBox(&outRect);
			outRect.InflateRect(5, 5);

			pDC->MoveTo(outRect.left, outRect.top);
			pDC->LineTo(outRect.right, outRect.top);
			pDC->LineTo(outRect.right, outRect.bottom);
			pDC->LineTo(outRect.left, outRect.bottom);
//.........这里部分代码省略.........
开发者ID:KnowNo,项目名称:backup,代码行数:101,代码来源:MyCom1.cpp

本文标签属性:

示例:示例英语

代码:代码编程

CClientDC:cclientdc绘制文字

Rectangle:rectangle怎么读

上一篇:什么叫做廉洁(什么是廉洁,什么是廉洁?)(什么是廉洁,)
下一篇:一个派出所副所长权力大吗(副所长是个什么级别)

为您推荐