C++ CPaintDC::Rectangle方法代码示例

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


C++ CPaintDC::Rectangle方法代码示例

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

示例1: DrawTree

void CChildView::DrawTree(CPaintDC& inDC, bool inUseRepaintRect)
{
	if (_tree == nullptr)
		return;

	CPen leafPen(PS_SOLID, 1, RGB(0, 0, 255));

	CBrush clearbrush;
	clearbrush.CreateSolidBrush(RGB(255, 255, 255));

	CBrush closedbrush;
	closedbrush.CreateSolidBrush(RGB(155, 155, 155));

	_tree->ForEachLeaf([&inDC, &clearbrush, &closedbrush, &leafPen](const CQuadLeaf& inLeaf)
	{
		inDC.SelectObject(&leafPen);
		if (inLeaf.IsClear())
			inDC.SelectObject(&clearbrush);
		else
			inDC.SelectObject(&closedbrush);

		Rect2Df boundrect = inLeaf.GetBound();

		inDC.Rectangle(&boundrect.GetWinRect());
	});
}
开发者ID:Isuroku,项目名称:QuadTreeDemo,代码行数:26,代码来源:ChildView.cpp

示例2: OnPaint

void CMainWindow::OnPaint ()
{
    CPaintDC dc (this);
    
    //
    // Initialize the device context.
    //
    dc.SetMapMode (MM_LOENGLISH);
    dc.SetTextAlign (TA_CENTER | TA_BOTTOM);
    dc.SetBkMode (TRANSPARENT);

    //
    // Draw the body of the ruler.
    //
    CBrush brush (RGB (255, 255, 0));
    CBrush* pOldBrush = dc.SelectObject (&brush);
    dc.Rectangle (100, -100, 1300, -200);
    dc.SelectObject (pOldBrush);

    //
    // Draw the tick marks and labels.
    //
    for (int i=125; i<1300; i+=25) {
        dc.MoveTo (i, -192);
        dc.LineTo (i, -200);
    }

    for (i=150; i<1300; i+=50) {
        dc.MoveTo (i, -184);
        dc.LineTo (i, -200);
    }

    for (i=200; i<1300; i+=100) {
        dc.MoveTo (i, -175);
        dc.LineTo (i, -200);

        CString string;
        string.Format (_T ("%d"), (i / 100) - 1);
        dc.TextOut (i, -175, string);
    }
}
开发者ID:jiayuehua,项目名称:MFCProgramming,代码行数:41,代码来源:Ruler.cpp

示例3: DrawField

void MyField::DrawField(CPaintDC &dc)
{
	for (int i = 0; i < row; i++)
	{
		for (int j = 0; j < col; j++)
		{
			SetDCPenColor(dc, RGB(0, 0, 0));
			SetDCBrushColor(dc, RGB(255, 255, 255));
			dc.Rectangle(i * RectSize, j * RectSize,
				i * RectSize + RectSize, j * RectSize + RectSize);
			if (arrVector[row*j + i] == 1) 
			{
				SetColor(dc);
				DrawRectByCoordanates(dc, i, j);
				SetDefaultColor(dc);
			}
		}
	}
	SetDCPenColor(dc, RGB(0, 0, 0));
	SetDCBrushColor(dc, RGB(0, 0, 0));
}
开发者ID:bodyk96,项目名称:Game_of_life,代码行数:21,代码来源:Field.cpp

示例4: DrawRectByCoordanates

void MyField::DrawRectByCoordanates(CPaintDC & dc, int i, int j)
{
	dc.Rectangle(i * RectSize, j * RectSize,
		i * RectSize + RectSize, j * RectSize + RectSize);
}
开发者ID:bodyk96,项目名称:Game_of_life,代码行数:5,代码来源:Field.cpp

本文标签属性:

示例:示例英语

代码:代码大全可复制

CPaintDC:CPaintDC

Rectangle:Rectangle

上一篇:Java Pair.makePair方法代码示例(javapair.makepair方法的典型用法代码示例)
下一篇:杀虎口白朗原型是什么样子的(白朗起义的经过)

为您推荐