本文整理汇总了C++中CDC::Arc方法的典型用法代码示例。如果您正苦于以下问题:C++ CDC::Arc方法的具体用法?C++ CDC::Arc怎么用?C++ CDC::Arc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDC
的用法示例。
在下文中一共展示了CDC::Arc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawACircle
//畫圈
void MsrFlow::DrawACircle(CPoint point)
{
/*
在此畫出來的圈是以160*160大小
以中心點為參考點畫出來的
原函數是以左上角為參考點,在此修正誤差,將決定好的參考點
再往左往上各算一個半徑的距離,畫出來
*/
//設定圈圈顏色=與背景相反顏色
COLORREF CircleColor;
CircleColor = RGB(255,255,255)-BackGroundColor;
//設定畫圈目標物位址
CWnd* pWndGrid = GetDlgItem(IDC_COLOR_PATTERN);
CDC* pDC = pWndGrid->GetDC();
//設定畫筆
CPen aPen;
aPen.CreatePen(PS_INSIDEFRAME,5,CircleColor);
//設定暫存畫筆空間
CPen* pOldPen = pDC ->SelectObject(&aPen);
//對圓修正誤差,從左上調到中心(開方形可繪區塊)
CPoint StartDrawPoint(-80,-80);
CPoint EndDrawPoint(80,80);
CRect* pRect = new CRect(point+StartDrawPoint,point+EndDrawPoint);
//畫下去(畫下圓形,起點0,0,終點0,0)
CPoint Start(0,0);
CPoint End(0,0);
pDC->Arc(pRect,Start,End);
//畫筆換回預設值
pDC->SelectObject(pOldPen);
}
示例2: OnShowSelectedLine
void CUnit::OnShowSelectedLine(){
//畫圓圈
CDC *pDC = CDDraw::GetBackCDC(); // 取得 Back Plain 的 CDC
CPen penBlack;
CPen penWhite;
CPen* pOldPen;
penBlack.CreatePen(PS_SOLID,1,RGB(0,0,0));
penWhite.CreatePen(PS_SOLID,1,RGB(255,255,255));
pOldPen = pDC->SelectObject(&penBlack);
CRect rect;
CPoint screenPoint(CConvert::GetScreenPointByMapPoint(mapPoint));
rect.SetRect( screenPoint.x-bmp->Width()/2-10,
screenPoint.y-25,
screenPoint.x+bmp->Width()/2+10,
screenPoint.y+5);
pDC->Arc(rect,rect.TopLeft(),rect.TopLeft());
rect.MoveToY(rect.top+1);
pDC->SelectObject(&penWhite);
pDC->Arc(rect,rect.TopLeft(),rect.TopLeft());
pDC->SelectObject(pOldPen); //
CDDraw::ReleaseBackCDC(); // 放掉 Back Plain 的 CDC
}
示例3: DrawVacuumPatch
void CDlgCreateVacuumPatch::DrawVacuumPatch()
{
if (m_VacuumPath != NULL)
{
CDC* pDC = GetDC();
CBrush ArrowBrush(COLORREF(0));
// CBrush BorderBrush(COLORREF(0x0));
/*Draw stuff*/
RECT OuterRect;
robPOINT RobotPoint;
POINT point;
CRect ProbGridBmpUpdateRect;
m_staVacuumPatchBounds.GetWindowRect(&ProbGridBmpUpdateRect);
ScreenToClient(&ProbGridBmpUpdateRect);
// CPoint SurfaceOffset = ProbGridBmpUpdateRect.TopLeft();
CRect SurfaceOffset = ProbGridBmpUpdateRect;
RobotPoint.x = m_Bounds.left, RobotPoint.y = m_Bounds.top;
point = RobotToDDSurface(RobotPoint, SurfaceOffset);
OuterRect.left = point.x;
OuterRect.top = point.y;
RobotPoint.x = m_Bounds.right, RobotPoint.y = m_Bounds.bottom;
point = RobotToDDSurface(RobotPoint, SurfaceOffset);
OuterRect.right = point.x;
OuterRect.bottom = point.y;
// pDC->FrameRect(&OuterRect, &BorderBrush);
unsigned short i = 0;
double HeadForward = m_HeadForward;
while (i < m_NumberPaths)
{
short CosFor = (short)Round(cos(HeadForward));
short SinFor = (short)Round(sin(HeadForward));
short CosNext = (short)Round(cos(m_HeadNext));
short SinNext = (short)Round(sin(m_HeadNext));
/*Draw line*/
POINT BmpPoint[4];
if (i != 0)
{
BmpPoint[0] = RobotToDDSurface(m_VacuumPath[i - 1].Arc2e, SurfaceOffset);
}
else
{
BmpPoint[0] = RobotToDDSurface(m_EntryPoint, SurfaceOffset);
}
pDC->MoveTo(BmpPoint[0]);
BmpPoint[0] = RobotToDDSurface(m_VacuumPath[i].Arc1s, SurfaceOffset);
pDC->LineTo(BmpPoint[0]);
/*Draw arrow head*/
double x1, y1, x2, y2;
x1 = m_VacuumPath[i].Arc1s.x - 30 * CosFor;
y1 = m_VacuumPath[i].Arc1s.y - 30 * SinFor;
RobotPoint.x = x1, RobotPoint.y = y1;
BmpPoint[0] = RobotToDDSurface(RobotPoint, SurfaceOffset);
x2 = x1 - CosFor * 30 - CosNext * 30;
y2 = y1 - SinFor * 30 - SinNext * 30;
RobotPoint.x = x2, RobotPoint.y = y2;
BmpPoint[1] = RobotToDDSurface(RobotPoint, SurfaceOffset);
x2 = x1 - CosFor * 30 + CosNext * 30;
y2 = y1 - SinFor * 30 + SinNext * 30;
RobotPoint.x = x2, RobotPoint.y = y2;
BmpPoint[2] = RobotToDDSurface(RobotPoint, SurfaceOffset);
BmpPoint[3] = BmpPoint[0];
CRgn ArrowRegion;
ArrowRegion.CreatePolygonRgn(BmpPoint, 4, ALTERNATE);
pDC->FillRgn(&ArrowRegion, &ArrowBrush);
/*If next vacuum path inside the patch, draw an arc to it*/
if (i < m_NumberPaths - 1)
{
/*Draw 2 arcs*/
/*Arc 1*/
CRect ArcRect;
short TurnDiameter = ABS(m_VacuumPath[i].TurnDiameter);
x1 = m_VacuumPath[i].Arc1s.x + CosFor * TurnDiameter / 2;
y1 = m_VacuumPath[i].Arc1s.y + SinFor * TurnDiameter / 2;
x2 = m_VacuumPath[i].Arc1s.x - CosFor * TurnDiameter / 2 + CosNext * TurnDiameter;
y2 = m_VacuumPath[i].Arc1s.y - SinFor * TurnDiameter / 2 + SinNext * TurnDiameter;
RobotPoint.x = x1, RobotPoint.y = y1;
point = RobotToDDSurface(RobotPoint, SurfaceOffset);
ArcRect.left = point.x, ArcRect.top = point.y;
RobotPoint.x = x2, RobotPoint.y = y2;
point = RobotToDDSurface(RobotPoint, SurfaceOffset);
ArcRect.right = point.x, ArcRect.bottom = point.y;
ArcRect.NormalizeRect();
if ((SinFor * CosNext == 1) || (CosFor * SinNext == -1))
{
BmpPoint[0] = RobotToDDSurface(m_VacuumPath[i].Arc1e, SurfaceOffset);
BmpPoint[1] = RobotToDDSurface(m_VacuumPath[i].Arc1s, SurfaceOffset);
}
else
{
BmpPoint[0] = RobotToDDSurface(m_VacuumPath[i].Arc1s, SurfaceOffset);
//.........这里部分代码省略.........