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


C++ Pen函数代码示例

本文整理汇总了C++中Pen函数的典型用法代码示例。如果您正苦于以下问题:C++ Pen函数的具体用法?C++ Pen怎么用?C++ Pen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Pen

void CDC::DrawExtrusion(const CRect& rRect)
{
	// Draw highlight.
	Pen(GetSysColor(COLOR_BTNHIGHLIGHT));
	Move(rRect.left,    rRect.bottom-1);
	Line(rRect.left,    rRect.top);
	Line(rRect.right-1, rRect.top);

	// Draw shadow.
	Pen(GetSysColor(COLOR_BTNSHADOW));
	Line(rRect.right-1, rRect.bottom-1);
	Line(rRect.left,    rRect.bottom-1);
}
开发者ID:chrisoldwood,项目名称:WIN16,代码行数:13,代码来源:DC.cpp

示例2: GetRValue

void CPropPageFrameDefault::FillGradientRectH(CDC *pDc, const RECT &rect, COLORREF clrLeft, COLORREF clrRight)
{
	// pre calculation
	int	nSteps = rect.right-rect.left;
	int	nRRange = GetRValue(clrRight)-GetRValue(clrLeft);
	int	nGRange = GetGValue(clrRight)-GetGValue(clrLeft);
	int	nBRange = GetBValue(clrRight)-GetBValue(clrLeft);

	double	dRStep = (double)nRRange/(double)nSteps;
	double	dGStep = (double)nGRange/(double)nSteps;
	double	dBStep = (double)nBRange/(double)nSteps;

	double	dR = (double)GetRValue(clrLeft);
	double	dG = (double)GetGValue(clrLeft);
	double	dB = (double)GetBValue(clrLeft);

	CPen	*pPrevPen = NULL;
	for (int x = rect.left; x <= rect.right; ++x)
	{
		CPen	Pen(PS_SOLID, 1, RGB((BYTE)dR, (BYTE)dG, (BYTE)dB));
		pPrevPen = pDc->SelectObject(&Pen);
		pDc->MoveTo(x, rect.top);
		pDc->LineTo(x, rect.bottom);
		pDc->SelectObject(pPrevPen);
		
		dR+= dRStep;
		dG+= dGStep;
		dB+= dBStep;
	}
}
开发者ID:Strongc,项目名称:playasa,代码行数:30,代码来源:PropPageFrameDefault.cpp

示例3: Pen

void LKSurface::DrawLine(Pen::Style PenStyle, const int width, const POINT& ptStart, const POINT& ptEnd, const LKColor& cr, const RECT& rc) {
    LKPen Pen(PenStyle, width, cr);
    const auto OldPen = SelectObject(Pen);

    const POINT pt[2] = {ptStart, ptEnd};
    Polyline(pt, 2, rc);

    SelectObject(OldPen);
}
开发者ID:acasadoalonso,项目名称:LK8000,代码行数:9,代码来源:LKSurface.cpp

示例4: Pen

void crobot::Refresh()
{
    QPen Pen(Qt::black, 5);
    pType->setRect(-(315/2),-(330/2),315,330);
    pType->setRotation(-nAngle);
    pType->setPos(nX,nY);

    pType->setPen(Pen);
}
开发者ID:Clav36,项目名称:Robotech_Gestion_Deplacements,代码行数:9,代码来源:crobot.cpp

示例5: dc

//
// This draws the background of a toolbar
//
void ToolBar::OnPaint( wxPaintEvent & event )
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   // Start with a clean background
   //
   // Under GTK, we specifically set the toolbar background to the background
   // colour in the system theme.
#if defined( __WXGTK__ )
   dc.SetBackground( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ) ) );
#endif

   dc.Clear();

// EXPERIMENTAL_THEMING is set to not apply the gradient
// on wxMAC builds.  on wxMAC we have the AQUA_THEME.
#ifdef USE_AQUA_THEME
   Repaint( &dc );
#else

#ifdef EXPERIMENTAL_THEMING
   wxImage * mpBackGradient =   &theTheme.Image( bmpRecoloredUpLarge  );

   if( mpBackGradient != NULL )
   {
      wxSize imSz( mpBackGradient->GetWidth(), mpBackGradient->GetHeight() );
      wxSize sz = GetSize();
      int y;
      for(y=0;y<sz.y;y++)
      {
         int yPix = ((float)y * imSz.y - 1.0f)/(sz.y-1);
         wxColour col(
            mpBackGradient->GetRed( 0, yPix),
            mpBackGradient->GetGreen( 0, yPix),
            mpBackGradient->GetBlue( 0, yPix));

         // Set background colour so that controls placed on this
         // toolbar such as radio buttons will draw reasonably.
         // It's a little tacky setting the background colour
         // here, but we can't do it in the constructor as the gradient
         // may not be available yet.
         // Better than this would be to set the colour when the image
         // is loaded.
         // We use the colour at the half way point as a suitable 'average'.
         if( y==(sz.y/2) )
         {
            SetBackgroundColour( col );
         }
         wxPen Pen( col );
         dc.SetPen(Pen );
         AColor::Line(dc, 0, y, sz.x, y );
      }
   }
#endif
#endif
}
开发者ID:jengelh,项目名称:audacity,代码行数:59,代码来源:ToolBar.cpp

示例6: notestKeyhole

 /**
  * Test a keyhole.
  */
 void notestKeyhole()
   {
   TS_TRACE("Canvas DrawKeyhole");
   int argc = 0;
   QApplication app(argc, (char **)nullptr, 0);
   Canvas c;
   Pen(Pen::SOLID, 1, Color(0, 0, 0));
   Brush(Color(128, 128, 0));
   c.DrawKeyhole(0, 0, 10, 20, Angle::Degrees(-10), Angle::Degrees(10));
   c.show();
   app.exec();
   }
开发者ID:Exadios,项目名称:YCSoar,代码行数:15,代码来源:Suite.test.hpp

示例7: DrawLine

void DrawLine(POINT OrgPt,POINT EndPt,CDC* pDC,COLORREF ColorRef,
              double Zoom)
{

   int W = (int)Zoom;
   if (W < 1) W = 1;

   CPen  Pen(PS_SOLID,W,ColorRef);
   CPen* pOldPen = (CPen*)pDC->SelectObject(&Pen);

   DrawLine(OrgPt,EndPt,pDC);

   pDC->SelectObject(pOldPen);

}
开发者ID:Mariademo,项目名称:alsigm,代码行数:15,代码来源:GEOM.CPP

示例8: ResetRegion

void DrawItemShape::OnPaint( Graphics &g )
{
	if(isChangeRegion())
	{
		ResetRegion();
	}
	auto region = getRegion();
	SolidBrush brush(DrawTools::ColorNormal);
	if (m_isFillPath)
	{
		if (StateNormal == m_state)
		{
			g.FillRegion(&brush, region.get());
		}
		else if (StateHovered == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorHovered), region.get());
		}
		else if (StateDisable == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorDisable), region.get());
		}
		else if (StateDown == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorDown), region.get());
		}
		else if (StateError == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorError), region.get());
		}
		else
		{
			g.FillRegion(&SolidBrush(m_fillColor), region.get());
		}
	}
	if (m_isDrawPath)
	{
		GraphicsPath path;
		path.StartFigure();
		for(auto itter = m_lines.begin();itter != m_lines.end() ; itter++ )
		{
			(*itter)->getPath(path);
		}
		path.CloseFigure();

		g.DrawPath(&Pen(m_drawColor),&path);
	}
}
开发者ID:jzaicn,项目名称:DrawTools,代码行数:48,代码来源:DrawItem.cpp

示例9: endPoint

void CurveBrush::strokePens(QPointF pi1, QPointF pi2, KisPainter &/*painter*/)
{
    if (m_pens.isEmpty()) {
        m_pens.append(Pen(pi1, 0.0, 1.0));
    }

    qreal dx = pi2.x() - pi1.x();
    qreal dy = pi2.y() - pi1.y();
    for (int i = 0; i < m_pens.length(); i++) {
        Pen &pen = m_pens[i];

        QPointF endPoint(dx, dy);

        QPainterPath path;
        path.moveTo(0, 0);
        path.lineTo(dx, dy);

        QTransform transform;
        transform.reset();
        transform.translate(pen.pos.x(), pen.pos.y());
        transform.scale(pen.scale, pen.scale);
        transform.rotate(pen.rotation);

        path = transform.map(path);
        //m_painter->drawPainterPath(path, QPen(Qt::white, 1.0));

        endPoint = transform.map(endPoint);
        m_painter->drawThickLine(pen.pos, endPoint, 1.0, 1.0);
        pen.pos = endPoint;
    }

    qreal branchThreshold = 0.5;
    if ((m_branch * drand48() > branchThreshold) && (m_pens.length() < 1024)) {
        int index = floor(drand48() * (m_pens.length() - 1));

        m_newPen.pos = m_pens.at(index).pos;
        m_newPen.rotation = drand48() * M_PI / 32; //atan(dy/dx) + (drand48() - 0.5) * M_PI/32;
        m_newPen.scale = drand48() * m_pens.at(index).scale;
        m_pens.append(m_newPen);
        dbgKrita << m_pens.length();
        m_branch = 0;
    }
    else {
        m_branch++;
    }
}
开发者ID:ChrisJong,项目名称:krita,代码行数:46,代码来源:curve_brush.cpp

示例10: RGB

void CPaintDlg::DrawObject(int x, int y, int type)
{
	COLORREF color;
	if (type == OBJ_CHARGER)
		color = RGB(0,0,255);
	else //type == OBJ_TECH
		color = RGB(255,0,0);
	CClientDC dc(this);
	GetClientRect(&DrawArea);
	CPen Pen(PS_SOLID,2,color);
	dc.SelectObject(Pen);
	int side = DrawArea.bottom/n;
	dc.MoveTo(x*side+1,y*side+1);
	dc.LineTo(x*side+side,y*side+side);
	dc.MoveTo(x*side+1,y*side+side);
	dc.LineTo(x*side+side,y*side+1);
}
开发者ID:AlsuShaykhattarova,项目名称:AS.1205.SysProg.1,代码行数:17,代码来源:PaintDlg.cpp

示例11: style

void Text::draw(Painter* p) const
      {
      Font f = style().font(spatium());
      p->drawText(f, QPointF(), _text);
#if 0
      QAbstractTextDocumentLayout::PaintContext c;
      c.cursorPosition = -1;
      if (cursor && !(score() && score()->printing())) {
            if (cursor->hasSelection()) {
                  QAbstractTextDocumentLayout::Selection selection;
                  selection.cursor = *cursor;
                  selection.format.setBackground(c.palette.brush(QPalette::Active, QPalette::Highlight));
                  selection.format.setForeground(c.palette.brush(QPalette::Active, QPalette::HighlightedText));
                  c.selections.append(selection);
                  }
            c.cursorPosition = cursor->position();
            }
      Color color = p->pen().color();
      c.palette.setColor(QPalette::Text, color);

      _doc->documentLayout()->draw(p->painter(), c);

      // draw frame
      if (hasFrame()) {
            Color color(frameColor());
            if (!visible())
                  color = Qt::gray;
            else if (selected())
                  color = preferences.selectColor[track() == -1 ? 0 : voice()];
            p->setPen(Pen(QBrush(color), frameWidth() * DPMM));
            p->setBrush(QBrush(Qt::NoBrush));
            if (circle())
                  p->drawArc(frame, 0, 5760);
            else {
                  int r2 = frameRound() * lrint((frame.width() / frame.height()));
                  if (r2 > 99)
                        r2 = 99;
                  p->drawRoundRect(frame, frameRound(), r2);
                  }
            }
#endif
      }
开发者ID:SSMN,项目名称:MuseScore,代码行数:42,代码来源:text.cpp

示例12: WXUNUSED

void wxPendulumDlg::wxPendulumDlgPaint(wxPaintEvent& WXUNUSED(event))
{
    SetBackgroundStyle(wxBG_STYLE_CUSTOM);
    wxBufferedPaintDC dc(this);

    // Get window dimensions
    wxSize sz = GetClientSize();
	// determine the center of the canvas
    const wxPoint center(wxPoint(sz.x / 2, sz.y / 2));

    // create background color
    wxColour powderblue = wxColour(176,224,230);

    // draw powderblue background
    dc.SetPen(powderblue);
    dc.SetBrush(powderblue);
    dc.DrawRectangle(0, 0, sz.x, sz.y);

    // draw lines
	wxPen Pen(*wxBLACK_PEN);
	Pen.SetWidth(1);
    dc.SetPen(Pen);
    dc.SetBrush(*wxBLACK_BRUSH);

    double angleAccel, dt = 0.15;

    angleAccel = (-9.81 / m_uiLength) * sin(m_Angle);
    m_AngleVelocity += angleAccel * dt;
    m_Angle += m_AngleVelocity * dt;

    int anchorX = sz.x / 2, anchorY = sz.y / 4;
    int ballX = anchorX + (int)(sin(m_Angle) * m_uiLength);
    int ballY = anchorY + (int)(cos(m_Angle) * m_uiLength);
    dc.DrawLine(anchorX, anchorY, ballX, ballY);

    dc.SetBrush(*wxGREY_BRUSH);
    dc.DrawEllipse(anchorX - 3, anchorY - 4, 7, 7);

    dc.SetBrush(wxColour(255,255,0)); // yellow
    dc.DrawEllipse(ballX - 7, ballY - 7, 20, 20);
}
开发者ID:Anatolt,项目名称:RosettaCodeData,代码行数:41,代码来源:animate-a-pendulum-2.cpp

示例13: GetRValue

void CGradientStatic::DrawHorizontalGradient()
{
	double dblRstep = (GetRValue(m_crColorRT) - GetRValue(m_crColorLB)) / static_cast<double>(m_Mem.cx);
	double dblGstep = (GetGValue(m_crColorRT) - GetGValue(m_crColorLB)) / static_cast<double>(m_Mem.cx);
	double dblBstep = (GetBValue(m_crColorRT) - GetBValue(m_crColorLB)) / static_cast<double>(m_Mem.cx);
	double r = GetRValue(m_crColorLB);
	double g = GetGValue(m_crColorLB);
	double b = GetBValue(m_crColorLB);

	for(int x = 0; x < m_Mem.cx; x++)
	{
		CPen Pen(PS_SOLID, 1, RGB(r,g,b));
		CPen* pOld = m_Mem.dc.SelectObject(&Pen);
		m_Mem.dc.MoveTo(x,0);
		m_Mem.dc.LineTo(x,m_Mem.cy);
		m_Mem.dc.SelectObject(pOld);

		r += dblRstep;
		g += dblGstep;
		b += dblBstep;
	}
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:22,代码来源:GradientStatic.cpp

示例14: color

void FrameView::addShape( const QVector<QPoint>& Shape )
{
  for(qint16 pointIndex(0); pointIndex < Shape.size(); pointIndex++)
  {
    Qt::GlobalColor color(getPointColorByIndex(pointIndex+1));
    QPen Pen(color);
    QList<QGraphicsItem*> pointGroupList;
    QGraphicsLineItem* line1(new QGraphicsLineItem(-POINT_SIZE, 0, POINT_SIZE, 0));
    line1->setPen(Pen);
    pointGroupList.push_back(line1);
    QGraphicsLineItem* line2(new QGraphicsLineItem(0, -POINT_SIZE, 0, POINT_SIZE));
    line2->setPen(Pen);
    pointGroupList.push_back(line2);
    QGraphicsTextItem* label(new QGraphicsTextItem(QString::number(pointIndex)));
    label->setDefaultTextColor(color);
    label->setFont(POINT_TEXT_FONT);
    label->setPos(-2*POINT_SIZE, -2.5f*POINT_SIZE);
    pointGroupList.push_back(label);

    QGraphicsItemGroup* pointGroup = Scene->createItemGroup(pointGroupList);
    pointGroup->setPos(QPointF(Shape[pointIndex]) * Scale);
  }
}
开发者ID:igrechuhin,项目名称:ComputerVision,代码行数:23,代码来源:FrameView.cpp

示例15: DrawArrow

void DrawArrow(POINT OrgPt,POINT EndPt,CDC* pDC,COLORREF ColorRef,double Zoom)
{

   //(EndPt.x)++;
   //(EndPt.y)++;

   int W = (int)Zoom;
   if (W < 1) W = 1;

   int H = (int)(10 * Zoom);
   int L = (int)( 3 * Zoom);

   CPen    Pen(PS_SOLID,W,ColorRef);
   CBrush  Brush(ColorRef);
   CPen*   pOldPen   = (CPen*)pDC->SelectObject(&Pen);
   CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&Brush);

   DrawArrow(OrgPt,EndPt,H,L,pDC);

   pDC->SelectObject(pOldPen);
   pDC->SelectObject(pOldBrush);

}
开发者ID:Mariademo,项目名称:alsigm,代码行数:23,代码来源:GEOM.CPP


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