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


C++ CContext::SelectBrush方法代码示例

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


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

示例1: Paint

// Display the line on the screen!
void CDrawLine::Paint(CContext &dc,paint_options options)
{
	if (m_use_default_style)
	{
		switch (xtype)
		{
		case xWire:
			dc.SelectPen( PS_SOLID,1, m_pDesign->GetOptions()->GetUserColor().Get( CUserColor::WIRE ), options );
			break;
		case xBus:
			dc.SelectPen( PS_SOLID,5, m_pDesign->GetOptions()->GetUserColor().Get( CUserColor::BUS ), options );
			break;
		default:
			dc.SelectPen(m_pDesign->GetOptions()->GetStyle(m_style), options);
			break;
		}
	}
	else
	{
		dc.SelectPen(m_pDesign->GetOptions()->GetStyle(m_style), options);
	}

  dc.SetROP2(R2_COPYPEN);

  dc.MoveTo(m_point_a);

  if (!m_segment) {
	  switch (g_EditToolBar.m_DrawLineEdit.mode) {
		case 1: dc.LineTo(CDPoint(m_point_b.x,m_point_a.y));
			break;
		case 2:	dc.LineTo(CDPoint(m_point_a.x,m_point_b.y));
			break;
	  }
  }
  dc.LineTo(m_point_b);

  if (is_stuck)
  {
	  // Draw a nice circle to show the stickness...
	  dc.PaintConnectPoint( m_point_b );

	  // Do we need a junction
	  if (is_junction)
	  {
	    int js=JUNCTION_SIZE;
		CDPoint br,tl;
		br=CDPoint(m_point_b.x+js+1,m_point_b.y+js+1);
		tl=CDPoint(m_point_b.x-js,m_point_b.y-js);

		dc.SetROP2(R2_COPYPEN);

		dc.SelectPen(PS_SOLID,1,m_pDesign->GetOptions()->GetUserColor().Get( CUserColor::JUNCTION) );
		dc.SelectBrush(m_pDesign->GetOptions()->GetUserColor().Get( CUserColor::JUNCTION));
  	    dc.Ellipse(CDRect(tl.x,tl.y,br.x,br.y));
	  }
  }

}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:59,代码来源:DrawLine.cpp

示例2: PaintHandles

void CDrawLine::PaintHandles( CContext &dc )
{
	dc.SelectBrush(cBLACK);
	dc.SelectPen(PS_SOLID,0,cBLACK);

	CDRect r1(m_point_a.x-2,m_point_a.y-2,m_point_a.x+2,m_point_a.y+2);
	CDRect r2(m_point_b.x-2,m_point_b.y-2,m_point_b.x+2,m_point_b.y+2);
	dc.Rectangle(r1);
	dc.Rectangle(r2);
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:10,代码来源:DrawLine.cpp

示例3: Paint

void CDrawBlockRotate::Paint(CContext &dc, paint_options options)
{
	// Draw marquee
	dc.SelectBrush();
	if (m_point_a.x < m_point_b.x)
	{
		dc.SelectPen(PS_MARQUEE, 1, cBLOCK);
	}
	else
	{
		// Other marquee pen for right to left selection
		dc.SelectPen(PS_MARQUEE2, 1, cBLOCK);
	}

	dc.SetROP2(R2_COPYPEN);
	dc.Rectangle(theArea);
}
开发者ID:soloveyhappy,项目名称:tiny,代码行数:17,代码来源:DrawBlockRotate.cpp

示例4: Paint

// Display the power item on the screen!
void CDrawPower::Paint(CContext &dc, paint_options options)
{
	int spacing;
	CDPoint pa, pb, pc, pd, pos = m_point_a;

	CalcLayout();

	dc.SelectFont(*m_pDesign->GetOptions()->GetFont(fPIN), 2);
	dc.SetROP2(R2_COPYPEN);
	dc.SetTextColor(m_pDesign->GetOptions()->GetUserColor().Get(CUserColor::POWER));

	if (which != 0) spacing = POWER_SIZE * 2 + POWER_SIZE / 4;
	else spacing = POWER_SIZE + POWER_SIZE / 4;

	// Find out which way round the power object goes
	switch (dir)
	{
		case 0: // Top
			pa = CDPoint(pos.x, pos.y - POWER_SIZE);
			pb = CDPoint(pos.x - POWER_SIZE / 2, pos.y - POWER_SIZE);
			pc = CDPoint(pos.x + POWER_SIZE / 2 + 1, pos.y - POWER_SIZE);
			pd = CDPoint(pos.x, pos.y - POWER_SIZE * 2);
			break;
		case 1: // Bottom
			pa = CDPoint(pos.x, pos.y + POWER_SIZE);
			pb = CDPoint(pos.x - POWER_SIZE / 2, pos.y + POWER_SIZE);
			pc = CDPoint(pos.x + POWER_SIZE / 2 + 1, pos.y + POWER_SIZE);
			pd = CDPoint(pos.x, pos.y + POWER_SIZE * 2);
			break;
		case 2: // Left
			pa = CDPoint(pos.x - POWER_SIZE, pos.y);
			pb = CDPoint(pos.x - POWER_SIZE, pos.y - POWER_SIZE / 2);
			pc = CDPoint(pos.x - POWER_SIZE, pos.y + POWER_SIZE / 2 + 1);
			pd = CDPoint(pos.x - POWER_SIZE * 2, pos.y);
			break;
		case 3: // Right
			pa = CDPoint(pos.x + POWER_SIZE, pos.y);
			pb = CDPoint(pos.x + POWER_SIZE, pos.y - POWER_SIZE / 2);
			pc = CDPoint(pos.x + POWER_SIZE, pos.y + POWER_SIZE / 2 + 1);
			pd = CDPoint(pos.x + POWER_SIZE * 2, pos.y);
			break;
	}

	dc.TextOut(str, TextPos, options);

	switch (options)
	{
		case draw_selected:
		case draw_selectable:
			dc.SelectPen(PS_SOLID, 1, cSELECT);
			break;
		default:
			dc.SelectPen(PS_SOLID, 1, cLINE);
	}

	dc.SelectBrush();

	// Draw the main line of the power item
	switch (which)
	{
		case 0: // Draw the Bar
			dc.MoveTo(pb);
			dc.LineTo(pc);
			break;
		case 1: // Draw the Circle
			dc.Ellipse(CDRect(pb.x - (pa.x - pd.x), pb.y - (pa.y - pd.y), pc.x, pc.y));
			break;
		case 2: // Draw the Wave
			// The PolyBezier function is not implemented in MFC!
			// So this hack has to be used....
		{
			CDPoint pts[4];
			pts[0] = CDPoint(pb.x + (pd.x - pa.x) / 2, pb.y + (pd.y - pa.y) / 2);
			pts[1] = CDPoint(pd.x + (pb.x - pa.x) / 2, pd.y + (pb.y - pa.y) / 2);
			pts[2] = CDPoint(pa.x + (pc.x - pa.x) / 2, pa.y + (pc.y - pa.y) / 2);
			pts[3] = CDPoint(pc.x - (pa.x - pd.x) / 2, pc.y - (pa.y - pd.y) / 2);
			dc.PolyBezier(pts, 4);
		}
			break;
		case 3: // Draw the Arrow
			dc.MoveTo(pb);
			dc.LineTo(pc);
			dc.MoveTo(pb);
			dc.LineTo(pd);
			dc.LineTo(pc);
			break;
		case 4: // Draw the Earth
			dc.MoveTo(pb);
			dc.LineTo(pc);
			dc.MoveTo(CDPoint(pb.x - (pb.x - pd.x) / 2, pb.y - (pb.y - pd.y) / 2));
			dc.LineTo(CDPoint(pc.x - (pc.x - pd.x) / 2, pc.y - (pc.y - pd.y) / 2));
			dc.MoveTo(CDPoint(pd.x - (pb.x - pa.x) / 4, pd.y - (pb.y - pa.y) / 4));
			dc.LineTo(CDPoint(pd.x + (pb.x - pa.x) / 4, pd.y + (pb.y - pa.y) / 4));
			break;
	}

	// Draw the bits that all power items have in comman
	dc.MoveTo(pos);
	dc.LineTo(pa);
//.........这里部分代码省略.........
开发者ID:soloveyhappy,项目名称:tiny,代码行数:101,代码来源:Power.cpp


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