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


C++ TDC::RestorePen方法代码示例

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


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

示例1: pen

void TSensorView::Grid3D(TDC& dc)
{
  if(m_bGrid)
  {
    TPen pen(TColor(192,192,192),0);
    dc.SelectObject(pen);
    for (int y = 0; y <= m_ySize ; y++)
    {
      MOVE(dc,Project2D(0,y,1));
      LINE(dc,Project2D(0,y,0));
      LINE(dc,Project2D(m_xSize,y,0));
    }
    for (int x = 0; x <= m_xSize; x++)
    {
      MOVE(dc,Project2D(x,0,1));
      LINE(dc,Project2D(x,0,0));
      LINE(dc,Project2D(x,m_ySize,0));
    }
    for (SHORTREAL z = 0; z < 1.05; z += (SHORTREAL) 0.1)
    {
      MOVE(dc,Project2D(0,m_ySize,z));
      LINE(dc,Project2D(0,0,z));
      LINE(dc,Project2D(m_xSize,0,z));
    }
    dc.RestorePen();
  }
}
开发者ID:OS2World,项目名称:APP-SCIENCE-SimRobot2,代码行数:27,代码来源:srSensorView.cpp

示例2: LineViewer

void TSensorView::LineViewer(TDC& dc,PSHORTREAL pData)
{
  m_xSize = m_nDimSize[0]-1;
  m_ySize = m_nDimSize[1]-1;
  m_yAdd = (int) (500L * m_ySize / m_xSize / 2);
  dc.SetWindowExt(TSize(m_xSize * 2 +  m_ySize,500 + m_yAdd));
  Grid3D(dc);
  if(m_nDimSize[1] == 1)
    for(int x = 0; x < m_nDimSize[0]; x++)
    {
      TPoint pt = Project2D(x,0,pData[x]);
      if (x)
        LINE(dc,pt);
      else
        MOVE(dc,pt);
    }
  else
  {
    TBrush br(SYSCOLOR(COLOR_BTNFACE));
    dc.SelectObject(br);
    for (int y = 0; y < m_nDimSize[1]-1; y++)
      for (int x = 0; x < m_nDimSize[0]-1; x++)
      {
        TPoint pt[4] =
        {
          Project2D(x,y,pData[x + (LONGINT) m_nDimSize[0] * y]),
          Project2D(x+1,y,pData[x+1 + (LONGINT) m_nDimSize[0] * y]),
          Project2D(x+1,y+1,pData[x+1 + (LONGINT) m_nDimSize[0] * (y+1)]),
          Project2D(x,y+1,pData[x + (LONGINT) m_nDimSize[0] * (y+1)])
        };
        POLY(dc,pt,4);
      }
  }
  dc.RestorePen();
}
开发者ID:OS2World,项目名称:APP-SCIENCE-SimRobot2,代码行数:35,代码来源:srSensorView.cpp

示例3: part

//
/// Puts the font into the device context and calls PaintGadgets.
///
/// Respond to virtual TWindow Paint call. Call our own virtual PaintGadgets
/// to actually perform the painting of the gadgets
//
void
TGadgetWindow::Paint(TDC& dc, bool erase, TRect& rect)
{
  if (IsBackgroundThemed())
  {
    TThemePart part(GetHandle(), (LPCWSTR) L"REBAR", 0, 0);
    part.DrawBackground(dc, GetClientRect(), rect);
    erase = false;
  }

  dc.SelectObject(*Font);
  PaintGadgets(dc, erase, rect);

#if defined(__TRACE) || defined(__WARN)
  // Highlight the tools of this gadgetwindow for debugging purposes.
  // Especially useful for docking windows which undergo internal state
  // changes
  //
  TProfile iniFile(_T("Diagnostics"), _T(OWL_INI));

  bool useDiagColor = iniFile.GetInt(_T("DiagToolbarBorders")) != 0;

  if (useDiagColor && Tooltip && Tooltip->IsWindow()) {
    uint count = Tooltip->GetToolCount();
    if (count) {
      TPen redPen(TColor(0xff, 0, 0));
      dc.SelectObject(redPen);

      TToolInfo ti;
      while (count) {
        if (Tooltip->EnumTools(--count, ti)) {
          dc.MoveTo(ti.rect.left, ti.rect.top);
          dc.LineTo(ti.rect.right,ti.rect.top);
          dc.LineTo(ti.rect.right,ti.rect.bottom);
          dc.LineTo(ti.rect.left, ti.rect.bottom);
          dc.LineTo(ti.rect.left, ti.rect.top);
        }
      }
      dc.RestorePen();
    }
  }
#endif
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:49,代码来源:gadgetwi.cpp

示例4: Paint

void npredictMDIChild::Paint ( TDC& dc , BOOL , TRect& )
{
	int i, j, n, b, row, col, rstart, rstop, cstart, cstop, prevcol ;
	int xlab_height, xlab_width, ylab_height, ylab_width, wide ;
	int xlab_lw, xlab_rw, tick_height, font_height, r0, r1, c0 ;
	double xscale, yscale, xtickscale, ytickscale, *sig, val ;
   double x, xfac ;
	char msg[256] ;
	TRect rect ;
	SIZE size ;
	TColor bkgnd, *lines ;
	TBrush *brush ;
	TPen *pen, *second_pen ;
   TFont *font ;

	n = istop - istart + 1 ;
	sig = signal->sig ;
	
	dc.SetMapMode ( MM_TEXT ) ;
	dc.SetROP2 ( R2_COPYPEN ) ;
	dc.SetBkMode ( OPAQUE ) ;
	bkgnd = dc.GetNearestColor ( TColor ( background_color ) ) ;
	dc.SetBkColor ( bkgnd ) ;
	GetClientRect ( rect ) ;
	b = rect.bottom ;   // We use origin at bottom, so b-y adapts to Windows

/*
	Paint the background
*/

	brush = new TBrush ( bkgnd ) ;
	dc.SelectObject ( *brush ) ;
	pen = new TPen ( bkgnd ) ;
	dc.SelectObject ( *pen ) ;
	dc.Rectangle ( rect ) ;
	dc.RestoreBrush () ;
	delete brush ;
	dc.RestorePen () ;
	delete pen ;
		
/*
   Setup main drawing pen and secondary pen for hash lines
*/

   lines = new TColor ( 0 , 0 , 0 ) ;
	pen = new TPen ( *lines , 1 , PS_SOLID ) ;
	second_pen = new TPen ( *lines , 1 , PS_DASH ) ;

/*
	Compute the maximum height and width of the axis tick labels.
	This lets us position the graph optimally.
*/
	
	xlab_height = xlab_width = ylab_height = ylab_width = xlab_lw = xlab_rw = 0 ;
	
	font_height = rect.bottom / 20 ;
	if (rect.right / 24 < font_height)
		font_height = rect.right / 24 ;

	if (font_height < 8)
      font_height = 0 ;

	if (font_height) {
		font = new TFont ( "Helvetica" , font_height ) ;
		dc.SelectObject ( *font ) ;
   	for (i=0 ; i<xnticks ; i++) {
   		sprintf ( msg , "%*.*lf", xndigits, xnfrac, xmin + i * xdif ) ;
   		GetTextExtentPoint ( dc , msg , strlen(msg) , &size ) ;
   		if (! i)
   			xlab_lw = size.cx ;      // Width of leftmost x label
   		if (i == xnticks-1)
   			xlab_rw = size.cx ;      // And rightmost x label
   		if (size.cx > xlab_width)
   			xlab_width = size.cx ;
   		if (size.cy > xlab_height)
   			xlab_height = size.cy ;
   		}

   	for (i=0 ; i<ynticks ; i++) {
   		sprintf ( msg , "%*.*lf", yndigits, ynfrac, ymin + i * ydif ) ;
   		GetTextExtentPoint ( dc , msg , strlen(msg) , &size ) ;
			if (size.cx > ylab_width)
				ylab_width = size.cx ;
			if (size.cy > ylab_height)
				ylab_height = size.cy ;
			}

		tick_height = xlab_height / 2 ;
		}

	else {
		tick_height = rect.bottom / 64  +  2 ;
      font = NULL ;
      }

/*
   Last check on label display.  Are X-axis labels to wide?
*/

   if ((xlab_width * xnticks) > (3 * rect.right / 4)) {
//.........这里部分代码省略.........
开发者ID:abishekahluwaila,项目名称:read,代码行数:101,代码来源:DISPLAY.CPP


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