예제 #1
0
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());
	});
}
예제 #2
0
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);
    }
}
예제 #3
0
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));
}
예제 #4
0
void MyField::DrawRectByCoordanates(CPaintDC & dc, int i, int j)
{
	dc.Rectangle(i * RectSize, j * RectSize,
		i * RectSize + RectSize, j * RectSize + RectSize);
}