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


C++ CPaintDC类代码示例

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


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

示例1: GetScrollPos

void CDataView::Render2D(CPaintDC& dc)
{
	CRect updateRect = dc.m_ps.rcPaint;


	int w = updateRect.Width();
	int h = updateRect.Height();

	int tx = updateRect.left;
	int ty = updateRect.top;
	
	int sx = std::max(0, GetScrollPos(SB_HORZ)) + tx;
	int sy = std::max(0, GetScrollPos(SB_VERT)) + ty;

#if 1
	dc.StretchBlt(
		tx, ty, w, h,
		m_memDC, sx/m_scale, sy/m_scale, w/m_scale, h/m_scale,
		SRCCOPY
		);
#else
	dc.BitBlt(
		tx,
		ty,
		w,
		h,
		m_memDC,
		sx,
		sy,
		SRCCOPY
	);
#endif
}
开发者ID:beru,项目名称:dataviewer,代码行数:33,代码来源:DataView.cpp

示例2: dc

void CStaticFilespec::OnPaint() 
{
CPaintDC		dc (this);            // device context for painting
DWORD       dwFormat;             // text format
RECT				rectWnd;						  // window rectangle
CString			strText;              // window text
CWnd*       pWndParent = NULL;    // parent window

	// Set default font
  pWndParent = GetParent();
  if (pWndParent)
     dc.SelectObject (pWndParent->GetFont());

	// Draw text
  GetWindowText (strText);
  GetClientRect (&rectWnd);
  dwFormat = m_dwFormat | (m_bPathEllipsis ? DT_PATH_ELLIPSIS : DT_END_ELLIPSIS);
  ::DrawTextEx (dc.m_hDC,
                strText.GetBuffer (0),
                strText.GetLength(),
                &rectWnd,
                dwFormat,
                NULL);
  strText.ReleaseBuffer();
	
	// Do not call CWnd::OnPaint() for painting messages
}
开发者ID:followboy1999,项目名称:BindFile,代码行数:27,代码来源:StaticFilespec.cpp

示例3: 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

示例4: dc

void CSplashWnd::OnPaint()
{
	CPaintDC dc (this);

	Graphics g (dc.GetSafeHdc ());
	g.DrawImage ((Bitmap*) *m_pBitmap, 0, 0, m_nWidth, m_nHeight);
}
开发者ID:matthias-christen,项目名称:CdCoverCreator,代码行数:7,代码来源:Splasher.cpp

示例5: DrawLine

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);
}
开发者ID:strogo,项目名称:AppRunner,代码行数:7,代码来源:Separator.cpp

示例6: DrawAd

void CHeaderDockPane::DrawAd(CPaintDC & dc)
{
	//CPaintDC dc(this); 
	//CDC pDC;
	//pDC.CreateCompatibleDC(&dc);

	CRect rect;
	GetClientRect(&rect);

	if(rect.right > 500)
	{
		CBrush bg;
		bg.CreateStockObject(RGB(0,0,0));
		CBrush fillBrush(RGB(250, 0, 0));
		CBrush *oldFillBrush = dc.SelectObject(&fillBrush);
		//rect = CRect( CPoint(rect.left, rect.top), CPoint(rect.right, rect.bottom - 2) );
		//rect = CRect( CPoint(200, 5), CPoint(400, 25) );
		//dc.FillRect(&rect, &bg);


		int height = 22;
		int progress_x = rect.right - 300 - 1;
		int progress_y = -22;
		CPoint prorgess_border_points[5];
		prorgess_border_points[0] = CPoint(progress_x, progress_y);
		prorgess_border_points[1] = CPoint(progress_x, progress_y + height);
		prorgess_border_points[2] = CPoint(progress_x+(rect.right - progress_x)-20 - 1, progress_y + height);
		prorgess_border_points[3] = CPoint(progress_x+(rect.right - progress_x)-20 - 1, progress_y);
		prorgess_border_points[4] = CPoint(progress_x, progress_y);
		CPen penOutline(PS_SOLID, 1, RGB(175, 175, 175));
		dc.SelectObject(&penOutline);
		dc.Polyline(prorgess_border_points, 5);

	}
}
开发者ID:Omgan,项目名称:RealFTP.net,代码行数:35,代码来源:HeaderDock.cpp

示例7: DrawText

void CDepartmentEstimationDialog::DrawText(CPaintDC &dc, CString Text, COLORREF Color, int l, int t, int r, int b)
{
	CRect TextRect(l, t, r, b);

	dc.SetTextColor(Color);
	dc.SetBkMode( TRANSPARENT );
	dc.DrawText(Text, &TextRect, DT_SINGLELINE | DT_CENTER);
}
开发者ID:FelGel,项目名称:BlueMagic,代码行数:8,代码来源:DepartmentEstimationDialog.cpp

示例8: DrawField

	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);

	}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:13,代码来源:ModelFormItem.cpp

示例9: PaintItems

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);
}
开发者ID:katakk,项目名称:iperf,代码行数:51,代码来源:IperfView.cpp

示例10: PaintVideoFrame

void CTimeEv::PaintVideoFrame(CPaintDC& dc)
{
	if(!m_hdd)
		return;

	m_videoRect = m_MainRect;
	
	m_videoRect.left += 11 + 550;
	m_videoRect.bottom -= 4; //45
	m_videoRect.top = m_videoRect.bottom - 206;
	m_videoRect.right = m_videoRect.left + 275;

	m_videoRect.left += 1;
	m_videoRect.top += 1;
	m_videoRect.right -= 1;
	m_videoRect.bottom -= 1;

	bool bChangeSz = false;

	if(m_videoRect.Width() != m_iFrameW)
	{
		m_iFrameW = m_videoRect.Width();
		bChangeSz = true;
	}
	
	if(m_videoRect.Height() != m_iFrameH)
	{
		m_iFrameH = m_videoRect.Height();
		bChangeSz = true;
	}

	if(bChangeSz || !m_pDIBFrame)
	{
		if(m_pDIBFrame) delete [] m_pDIBFrame;
		makeRgbDIB(m_pDIBFrame,m_iFrameW,m_iFrameH,0,0);
	}
		
	LPBITMAPINFOHEADER pBMP = m_oAVIR.GetCurrentFrame();

//	SaveBMP(pBMP,"orig_frame.bmp");

	if(!pBMP)
	{	Write2Log("Couldn't extract frame %d",m_oAVIR.CurrentFrame());
		return;
	}

	BITMAPINFOHEADER* pbmpnew = (BITMAPINFOHEADER*)m_pDIBFrame;

	StretchDIB(pbmpnew,(byte*)pbmpnew+sizeof(BITMAPINFOHEADER),0,0,pbmpnew->biWidth,pbmpnew->biHeight,
		pBMP,(byte*)pBMP+sizeof(BITMAPINFOHEADER),0,0,pBMP->biWidth,pBMP->biHeight);

	//byte* pdata=(byte*)pBMP+pBMP->biSize+pBMP->biClrUsed*sizeof(RGBQUAD);
	byte* pdata = (byte*)pbmpnew+sizeof(BITMAPINFOHEADER);

//	SaveBMP(pbmpnew,"new_frame.bmp");

	// Convert Data To Requested Bitmap Format & Draw IT!!!
	DrawDibDraw(m_hdd, dc.GetSafeHdc(), m_videoRect.left, m_videoRect.top, pbmpnew->biWidth, pbmpnew->biHeight, pbmpnew, pdata, 0, 0, pbmpnew->biWidth, pbmpnew->biHeight, 0);
}
开发者ID:FentonLab,项目名称:WClust_src,代码行数:59,代码来源:TimeEv.cpp

示例11: dc

void CMainWindow::OnPaint()
{
	// Paint handler device context to THIS window!
	CPaintDC	dc (this);
	CRect		rect;

	// current bounding rectangle of entire client area...


	GetClientRect (&rect);

	
	dc.DrawText("Hello, mo fo.", 
				-1 , 
				&rect,
				DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
开发者ID:amitahire,项目名称:development,代码行数:17,代码来源:hello.cpp

示例12: DrawSquare

void CDepartmentEstimationDialog::DrawSquare(CPaintDC &dc, COLORREF Color, int l, int t, int r, int b)
{
	CRect UserRect(l, t, r, b);

	CBrush brush(Color);
	dc.FillRect(UserRect, &brush);
	brush.DeleteObject();
}
开发者ID:FelGel,项目名称:BlueMagic,代码行数:8,代码来源:DepartmentEstimationDialog.cpp

示例13: PaintXMaps

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);
	}
}
开发者ID:katakk,项目名称:iperf,代码行数:17,代码来源:IperfView.cpp

示例14: AxeGraph

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);
}
开发者ID:clemaitre58,项目名称:CRDAorta,代码行数:20,代码来源:AfficheMesPol.cpp

示例15: DoPaint

// 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);
	}
}
开发者ID:f059074251,项目名称:interested,代码行数:24,代码来源:FileOpenDlg.cpp


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