本文整理汇总了C++中CDC::AngleArc方法的典型用法代码示例。如果您正苦于以下问题:C++ CDC::AngleArc方法的具体用法?C++ CDC::AngleArc怎么用?C++ CDC::AngleArc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDC
的用法示例。
在下文中一共展示了CDC::AngleArc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTime
void CClock::DrawTime( CDC *pDc )
{
CRect rtClient;
GetClientRect(&rtClient);
CDC dcTransparent;
dcTransparent.CreateCompatibleDC(pDc);
CBitmap bitTransParent;
bitTransParent.CreateCompatibleBitmap(pDc, rtClient.Width(),rtClient.Height());
dcTransparent.SelectObject(&bitTransParent);
// CRect rectReal(ix1, iy1, ix2, iy2);
dcTransparent.FillSolidRect(rtClient, RGB(255, 255, 255));
// dcTransparent.Draw3dRect(rectReal, RGB(111, 147, 188), RGB(111, 147, 188));
dcTransparent.BeginPath();
dcTransparent.MoveTo(rtClient.Width()/2, rtClient.Height()/2);
dcTransparent.LineTo(rtClient.Width()/2-80, rtClient.Height()/2);
float fEnd = 90.0f;
dcTransparent.AngleArc(rtClient.Width()/2, rtClient.Height()/2, 120, -180.0f, 270.0f);
dcTransparent.LineTo(rtClient.Width()/2, rtClient.Height()/2);
dcTransparent.EndPath();
CRgn rgn;
rgn.CreateFromPath(&dcTransparent);
dcTransparent.FillRgn(&rgn, &CBrush(RGB(188, 199, 216)));
//内
dcTransparent.BeginPath();
dcTransparent.MoveTo(rtClient.Width()/2, rtClient.Height()/2);
dcTransparent.LineTo(rtClient.Width()/2-40, rtClient.Height()/2);
dcTransparent.AngleArc(rtClient.Width()/2, rtClient.Height()/2, 40, -180.0f, 270.0f);
dcTransparent.LineTo(rtClient.Width()/2, rtClient.Height()/2);
dcTransparent.EndPath();
CRgn rgn1;
rgn1.CreateFromPath(&dcTransparent);
dcTransparent.FillRgn(&rgn1, &CBrush(RGB(255, 255, 0)));
if( ::AlphaBlend == 0 )
{
pDc->StretchBlt(0, 0, rtClient.Width(), rtClient.Height(),
&dcTransparent, 0, 0, rtClient.Width(), rtClient.Height(), SRCINVERT );
}else{
BLENDFUNCTION bf;
memset( &bf, 0, sizeof( bf ) );
bf.SourceConstantAlpha = 0x9f; //半透明
bf.BlendOp = AC_SRC_OVER;
::TransparentBlt(pDc->GetSafeHdc(), 0, 0, rtClient.Width(), rtClient.Height(),
dcTransparent.GetSafeHdc( ), 0, 0, rtClient.Width(), rtClient.Height(), RGB(255, 255, 255));
// ::AlphaBlend( memDC.GetSafeHdc(), 0, 0, rtClient.Width(), rtClient.Height(),
// dcTransparent.GetSafeHdc( ), 0, 0, rtClient.Width(), rtClient.Height(), bf );
}
bitTransParent.DeleteObject();
dcTransparent.DeleteDC();
}
示例2: Draw
void MyObj::Draw(CDC &dc){
dc.MoveTo(m_dCenterX,m_dCenterY);
dc.LineTo(m_dCenterX,m_dCenterY-m_dA/2+m_dA1);
dc.MoveTo(m_dCenterX,m_dCenterY-m_dA+m_dA1/2);
dc.AngleArc(m_dCenterX,m_dCenterY-m_dA/2,m_dA1,90,180);
dc.MoveTo(m_dCenterX,m_dCenterY-m_dA+m_dA1/2);
dc.LineTo(m_dCenterX,m_dCenterY-m_dA);
dc.LineTo(m_dCenterX-m_dA+m_dA2,m_dCenterY-m_dA);
dc.AngleArc(m_dCenterX-m_dA+m_dA2,m_dCenterY-m_dA+m_dA2,m_dA2,90,90);
dc.LineTo(m_dCenterX-m_dA,m_dCenterY-m_dA3);
dc.MoveTo(m_dCenterX-m_dA+m_dA3,m_dCenterY);
dc.AngleArc(m_dCenterX-m_dA,m_dCenterY,m_dA3,0,90);
dc.MoveTo(m_dCenterX-m_dA+m_dA3,m_dCenterY);
dc.LineTo(m_dCenterX,m_dCenterY);
}
示例3: DrawDrawing
// *****************************************************************
// DrawDrawing()
// *****************************************************************
void CMapView::DrawDrawing(Gdiplus::Graphics* graphics, DrawList * dlist)
{
HDC hdc = graphics->GetHDC();
CDC* dc = CDC::FromHandle(hdc);
CBrush * brush = new CBrush();
CPen * pen = new CPen();
CBrush * oldBrush = NULL;
CPen * oldPen = NULL;
CRect rect;
double pixX, pixY;
register int j;
if( dlist->listType == dlScreenReferencedList )
{
for(unsigned i = 0; i < dlist->m_dpolygons.size(); i++)
{
if( dlist->m_dpolygons[i]->numPoints > 0 )
{
CPoint * pnts = new CPoint[dlist->m_dpolygons[i]->numPoints];
long endcondition2 = dlist->m_dpolygons[i]->numPoints;
for(j=0;j<endcondition2;j++)
{
//Rob Cairns 10 Jan 06
int xpt = Utility::Rint(dlist->m_dpolygons[i]->xpnts[j]);
int ypt = Utility::Rint(dlist->m_dpolygons[i]->ypnts[j]);
pnts[j] = CPoint(xpt,ypt);
}
if( dlist->m_dpolygons[i]->fill )
{
brush->CreateSolidBrush(dlist->m_dpolygons[i]->color);
pen->CreatePen(PS_SOLID,dlist->m_dpolygons[i]->width,dlist->m_dpolygons[i]->color);
oldBrush = dc->SelectObject(brush);
oldPen = dc->SelectObject(pen);
dc->Polygon(pnts,dlist->m_dpolygons[i]->numPoints);
dc->SelectObject(oldBrush);
dc->SelectObject(oldPen);
pen->DeleteObject();
brush->DeleteObject();
}
else
{
pen->CreatePen(PS_SOLID,dlist->m_dpolygons[i]->width,dlist->m_dpolygons[i]->color);
oldPen = dc->SelectObject(pen);
dc->Polyline(pnts,dlist->m_dpolygons[i]->numPoints);
dc->SelectObject(oldPen);
pen->DeleteObject();
}
delete [] pnts;
}
}
for(unsigned int i = 0; i < dlist->m_dcircles.size(); i++)
{
if( dlist->m_dcircles[i]->fill )
{
brush->CreateSolidBrush(dlist->m_dcircles[i]->color);
pen->CreatePen(PS_SOLID,dlist->m_dcircles[i]->width,dlist->m_dcircles[i]->color);
oldBrush = dc->SelectObject(brush);
oldPen = dc->SelectObject(pen);
dc->Ellipse((int)(dlist->m_dcircles[i]->x - dlist->m_dcircles[i]->radius),
(int)(dlist->m_dcircles[i]->y - dlist->m_dcircles[i]->radius),
(int)(dlist->m_dcircles[i]->x + dlist->m_dcircles[i]->radius),
(int)(dlist->m_dcircles[i]->y + dlist->m_dcircles[i]->radius) );
dc->SelectObject(oldBrush);
dc->SelectObject(oldPen);
pen->DeleteObject();
brush->DeleteObject();
}
else
{
pen->CreatePen(PS_SOLID,dlist->m_dcircles[i]->width,dlist->m_dcircles[i]->color);
oldPen = dc->SelectObject(pen);
dc->MoveTo((int)(dlist->m_dcircles[i]->x+dlist->m_dcircles[i]->radius), (int)dlist->m_dcircles[i]->y);
dc->AngleArc((int)(dlist->m_dcircles[i]->x), (int)(dlist->m_dcircles[i]->y), (int)(dlist->m_dcircles[i]->radius),0,360);
dc->SelectObject(oldPen);
pen->DeleteObject();
}
}
for(unsigned int i = 0 ; i < dlist->m_dlines.size(); i++)
{
CPoint *pnts = new CPoint[2];
pen->CreatePen(PS_SOLID,dlist->m_dlines[i]->width,dlist->m_dlines[i]->color);
oldPen = dc->SelectObject(pen);
//Rob Cairns 10 Jan 06
int ptX1 = Utility::Rint(dlist->m_dlines[i]->x1);
int ptY1 = Utility::Rint(dlist->m_dlines[i]->y1);
int ptX2 = Utility::Rint(dlist->m_dlines[i]->x2);
int ptY2 = Utility::Rint(dlist->m_dlines[i]->y2);
pnts[0]=CPoint(ptX1,ptY1);
pnts[1]=CPoint(ptX2,ptY2);
dc->Polyline(pnts,2);
//.........这里部分代码省略.........