本文整理汇总了C++中CContext::Ellipse1方法的典型用法代码示例。如果您正苦于以下问题:C++ CContext::Ellipse1方法的具体用法?C++ CContext::Ellipse1怎么用?C++ CContext::Ellipse1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContext
的用法示例。
在下文中一共展示了CContext::Ellipse1方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
//.........这里部分代码省略.........
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);
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, m_point_b.y + js);
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.Ellipse1(CDRect(tl.x, tl.y, br.x, br.y));
}
}
}
示例2: 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, m_point_b.y + js);
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.Ellipse1(CDRect(tl.x, tl.y, br.x, br.y));
}
}
}