コード例 #1
0
	void CModelFormItem::DrawField(CPaintDC & dc)
	{
		CRect rectItem;
		GetClientRect(rectItem);
		int eff = m_param.GetEndFirstField();
		int bsf = m_param.GetBeginSecondField();

		dc.MoveTo(eff, rectItem.top + 2);
		dc.LineTo(eff, rectItem.bottom - 2);
		dc.MoveTo(bsf, rectItem.top + 2);
		dc.LineTo(bsf, rectItem.bottom - 2);

	}
コード例 #2
0
ファイル: Separator.cpp プロジェクト: strogo/AppRunner
void CSeparator::DrawLine(CPaintDC &dc, CRect &clientRect)
{
   HPEN hp = dc.SelectPen(Globals::Instance().sep.pen);
   dc.MoveTo(clientRect.left, (clientRect.top + clientRect.bottom) / 2-1);
   dc.LineTo(clientRect.right, (clientRect.top + clientRect.bottom) / 2-1);
   dc.SelectPen(hp);
}
コード例 #3
0
void CAfficheMesPol::AxeGraph(CPaintDC &dc)
{
	dc.FillSolidRect(PosGrX(0),PosGrY(255),PosGrX(255)-20,PosGrY(0)-40,RGB(255,255,255));

	CPen PenAxe(PS_SOLID,1,RGB(0,0,0));
	dc.SelectObject(&PenAxe);
	dc.MoveTo(PosGrX(0),PosGrY(0));
	dc.LineTo(PosGrX(0),PosGrY(255));
	dc.MoveTo(PosGrX(0),PosGrY(0));
	dc.LineTo(PosGrX(255),PosGrY(0));

	for(int i=5;i<255;i+=5)
	{
		dc.MoveTo(PosGrX(0),PosGrY(i));
		dc.LineTo(PosGrX(3),PosGrY(i));
		dc.MoveTo(PosGrX(i),PosGrY(0));
		dc.LineTo(PosGrX(i),PosGrY(3));
	}
	DeleteObject(&PenAxe);
}
コード例 #4
0
ファイル: FileOpenDlg.cpp プロジェクト: f059074251/interested
// CFileOpenDlg::DoPaint
//
//		Paints the splitter if it is displayed
//
void CFileOpenDlg::DoPaint(CPaintDC& dc) 
{
	if(m_nState == vsStandard)
	{
		CRect	rcClient;
		int		y;

		GetClientRect(&rcClient);

		y = m_ySplit;

		dc.MoveTo(0, y);
		dc.LineTo(rcClient.right, y);

		y += 6;		// This is the splitter height

		dc.MoveTo(0, y);
		dc.LineTo(rcClient.right, y);
	}
}
コード例 #5
0
ファイル: Ruler.cpp プロジェクト: jiayuehua/MFCProgramming
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);
    }
}
コード例 #6
0
ファイル: IperfView.cpp プロジェクト: katakk/iperf
void CIperfView::PaintItems(CPaintDC &dc, CIperfViewItem *pa)
{
	POSITION pos;
	INT_PTR count;
	INT_PTR idx = 0;
	double x0 = 0, x1 = 0, y = 0;
	double t0, t1;
	double xstep, ystep;
	double speed;
	int fast = 0;
	CRect rect;

	count = pa->m_List.GetCount();
	GetClientRect(&rect);

    xstep = rect.Width() / 60.0;
    ystep = rect.Height() / HEIGHT;

	CPen pen(PS_SOLID, 1, pa->m_color);
	CPen* pOldPen = dc.SelectObject(&pen);


    for ( pos = pa->m_List.GetHeadPosition(); pos != NULL; pa->m_List.GetNext( pos ) )
    {
		t0 = pa->m_List.GetAt( pos ).t0;
		t1 = pa->m_List.GetAt( pos ).t1;
		if(pa->m_List.GetAt( pos ).speed) {
			speed = 10*log10(pa->m_List.GetAt( pos ).speed);
		} else {
			speed = 0;
		}

		//
		x0 = t0 * xstep;
		x1 = t1 * xstep;
		y = rect.Height() - speed * ystep;

		// point set
		CRect rect0( (int)x0-2, (int)y-2, (int)x0+2, (int)y+2);
		CRect rect1( (int)x1-2, (int)y-2, (int)x1+2, (int)y+2);

		//dc.Ellipse(rect0);
		dc.Ellipse(rect1);

		if(fast++ == 0)
			dc.MoveTo(CPoint((int)x0,(int)y));
		dc.LineTo(CPoint((int)x1,(int)y));

	}
	dc.SelectObject(pOldPen);
}
コード例 #7
0
ファイル: IperfView.cpp プロジェクト: katakk/iperf
void CIperfView::PaintXMaps(CPaintDC &dc)
{
	CRect rect;
	GetClientRect(&rect);
	double x, xstep;

	xstep = rect.Width() / 60.0 * 2;
	for(x =0.0; x < rect.Width() ; x += xstep)
	{
		CPen pen(PS_SOLID, 1, RGB(240,240,240));
		CPen* pOldPen = dc.SelectObject(&pen);

		dc.MoveTo(CPoint( (int)x, 1));
		dc.LineTo(CPoint( (int)x, (int)rect.Height() - 1));
		dc.SelectObject(pOldPen);
	}
}
コード例 #8
0
void CDepartmentEstimationDialog::DrawDepartment(CPaintDC &dc, std::vector<SPosition> Coordinates, std::string DerpartmentName /*= ""*/)
{
	// First, Draw Contour
	// -------------------
	if (Coordinates.size() == 0)
		return;

	CBrush brush(3, RGB(255,255,255));	
	dc.SelectObject(&brush); 

	dc.MoveTo(ConvertPhysicalCoordinateToCanvas(Coordinates[0]));

	for (unsigned int i = 1; i < Coordinates.size(); i++)
	{
		dc.LineTo(ConvertPhysicalCoordinateToCanvas(Coordinates[i]));
	}

	dc.LineTo(ConvertPhysicalCoordinateToCanvas(Coordinates[0]));

	brush.DeleteObject();

	if (DerpartmentName == "")
		return; // this is the establishment itself and does not require name printing

	// Then, Print Title
	// -----------------
	CRectReal RectReal = GetEncapsulatingRect(Coordinates);
	SPosition DepartmentNamePosition;
	
	DepartmentNamePosition.x = (RectReal.left + RectReal.right) / 2;
	DepartmentNamePosition.y = (RectReal.top + RectReal.bottom) / 2;

	POINT DepartmentNamePositionOnCanvas = ConvertPhysicalCoordinateToCanvas(DepartmentNamePosition);

	DrawText(dc, DerpartmentName.c_str(), RGB(255,255,255), 
		DepartmentNamePositionOnCanvas.x - HALF_TEXT_WIDTH,
		DepartmentNamePositionOnCanvas.y - HALF_TEXT_HEIGHT,
		DepartmentNamePositionOnCanvas.x + HALF_TEXT_WIDTH,
		DepartmentNamePositionOnCanvas.y + HALF_TEXT_HEIGHT);
}
コード例 #9
0
ファイル: IperfView.cpp プロジェクト: katakk/iperf
void CIperfView::PaintYMaps(CPaintDC &dc)
{
	CRect rect;
	GetClientRect(&rect);
	double y, ystep, k, j;

	ystep =  rect.Height() / HEIGHT;
	for(j = 1; j < 10000000000; j*=10)
	{
		for(k = 1; k < 10; k++)
		{
			y = rect.Height() - 10*log10(k*j) * ystep;
			if(y < 0) goto over;
			CPen pen(PS_SOLID, 1, ((k != 1) ? RGB(240,240,240) : RGB(120,120,120)) );
			CPen* pOldPen = dc.SelectObject(&pen);
			dc.MoveTo(CPoint( 1, (int)y));
			dc.LineTo(CPoint( (int)rect.Width() -1, (int)y));
			dc.SelectObject(pOldPen);
		}
	}
over:
	return;
}