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


C++ wxDC::GetPen方法代码示例

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


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

示例1: Draw

void wxlCanObj::Draw( wxDC& dc, double absx, double absy )
{
    if ( m_brush.Ok() )
        dc.SetBrush( m_brush );
    if ( m_pen.Ok() )
        dc.SetPen( m_pen );

    wxBrush currentBrush = dc.GetBrush();
    wxPen currentPen = dc.GetPen();

    absx += m_x;
    absy += m_y;

    DoDraw( dc, absx, absy );

    // iterate over the child list
    for ( wxlCanObjList::Node *node = m_objects.GetFirst(); node; node = node->GetNext() )
    {
        wxlCanObj *drawobj = node->GetData();
        // restore brush and pen
        dc.SetBrush( currentBrush );
        dc.SetPen( currentPen );
        drawobj->Draw( dc , absx, absy );
    }
}
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:25,代码来源:canlua.cpp

示例2: Draw

bool RedHatchDrawlet::Draw(wxDC &dc)
{
#if wxCHECK_VERSION(2, 9, 0)
    wxRasterOperationMode old_lf = dc.GetLogicalFunction();
#else
    int old_lf = dc.GetLogicalFunction();
#endif
    dc.SetLogicalFunction(wxXOR);

    wxPen old_pen = dc.GetPen();
    wxBrush old_brush = dc.GetBrush();

    wxColor red = wxColor( ~wxRED->Red(), ~wxRED->Green(), ~wxRED->Blue());
#if wxCHECK_VERSION(2,9,0)
    wxBrush brush = wxBrush(red, wxHATCHSTYLE_CROSSDIAG );
#else
    wxBrush brush = wxBrush(red, wxCROSSDIAG_HATCH );
#endif

    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.SetBrush(brush);

    dc.DrawRectangle(m_rect);

    dc.SetLogicalFunction(old_lf);
    dc.SetPen(old_pen);
    dc.SetBrush(old_brush);

    return true;
}
开发者ID:simple-codeblocks,项目名称:Codeblocks,代码行数:30,代码来源:RedHatchDrawlet.cpp

示例3: drawTopLine

void SeqABI::drawTopLine ( wxDC &dc , int y )
    {
    wxPen p = dc.GetPen () ;
    dc.SetPen(*wxLIGHT_GREY_PEN);
    dc.DrawLine ( 4 , y , minx + maxx , y ) ;
    dc.SetPen(p);
    }
开发者ID:magnusmanske,项目名称:gentle-m,代码行数:7,代码来源:SequenceTypeABI.cpp

示例4: wxDrawRectangle

// For some reason, drawing a rectangle on a memory DC has problems.
// Use this substitute if we can.
static void wxDrawRectangle(wxDC& dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
    wxBrush brush(dc.GetBrush());
    wxPen pen(dc.GetPen());
    if (brush.Ok() && brush.GetStyle() != wxTRANSPARENT)
    {
        HBRUSH hBrush = (HBRUSH) brush.GetResourceHandle() ;
        if (hBrush)
        {
            RECT rect;
            rect.left = x;
            rect.top = y;
            rect.right = x + width - 1;
            rect.bottom = y + height - 1;
            ::FillRect((HDC) dc.GetHDC(), &rect, hBrush);
        }
    }
    width --;
    height --;
    if (pen.Ok() && pen.GetStyle() != wxTRANSPARENT)
    {
        dc.DrawLine(x, y, x + width, y);
        dc.DrawLine(x, y, x, y + height);
        dc.DrawLine(x, y+height, x+width, y + height);
        dc.DrawLine(x+width, y+height, x+width, y);
    }
}
开发者ID:ahlekoofe,项目名称:gamekit,代码行数:29,代码来源:dcmemory.cpp

示例5: DrawStaticBox

void UIElementVectorial::DrawStaticBox(wxDC& dc,const wxString& label, const wxPoint& pos, const wxSize& size)
{
	wxColour c_pen = dc.GetPen().GetColour();
	dc.SetPen(wxPen(dc.GetTextForeground()));
	dc.DrawRoundedRectangle(pos.x, pos.y, size.x, size.y,3.1f);
	dc.SetPen(wxPen(c_pen));
	dc.DrawRotatedText(label,pos.x+10,pos.y,0);
}
开发者ID:BackupTheBerlios,项目名称:rvzware,代码行数:8,代码来源:UIElementVectorial.cpp

示例6: DrawAquaRect

void DrawAquaRect(wxDC& dc, wxRect& rc, int radius)
{
	int left	= rc.GetX();
	int top		= rc.GetTop();
	int height	= rc.GetHeight();
	int width	= rc.GetWidth();
	int right	= left+width;

	if(width <= radius*2)
		return;

	wxPen oldpen = dc.GetPen();

	int border	= 2;//(IsSelected() ? 2 : 1);

	int edge = radius;
	int endEdge = top+radius;
	float rstep = 60.f / ((float)height / 3.f);
	float gstep = 20.f / ((float)height / 3.f);
	float r=180.f, g=190.f, b=225.f;
	for(int y=top+1; y<top+height/3; y++)
	{
		r -= rstep;
		g -= gstep;
		dc.SetPen( wxPen(wxColor(r, g, b), border) );
		if(y<endEdge)
		{
			dc.DrawLine(left+edge, y, right-edge*2, y);
			edge--;
		}
		else
			dc.DrawLine(left, y, right, y);
	}

	edge = 1;
	int startEdge = top+height-radius;
	rstep = 75.f / (((float)height / 3.f) * 2.f);
	gstep = 51.f / (((float)height / 3.f) * 2.f);
	r=111.f, g=161.f, b=225.f;
	for(int y=top+height/3; y<top+height-1; y++)
	{
		r += rstep;
		g += gstep;
		dc.SetPen( wxPen(wxColor(r, g, b), border) );
		if(y>=startEdge)
		{
			dc.DrawLine(left+edge, y, right-edge*2, y);
			edge++;
		}
		else
			dc.DrawLine(left, y, right, y);
	}

	dc.SetPen( oldpen );
}
开发者ID:sqba,项目名称:floopy,代码行数:55,代码来源:aqua.cpp

示例7: draw_line_with_style

void draw_line_with_style(wxDC& dc, wxPenStyle style,
                          wxCoord X1, wxCoord Y1, wxCoord X2, wxCoord Y2)
{
    wxPen pen = dc.GetPen();
    wxPenStyle old_style = pen.GetStyle();
    pen.SetStyle(style);
    dc.SetPen(pen);
    dc.DrawLine (X1, Y1, X2, Y2);
    pen.SetStyle(old_style);
    dc.SetPen(pen);
}
开发者ID:darckense,项目名称:fityk,代码行数:11,代码来源:plot.cpp

示例8: DrawBG

void CPathItem::DrawBG(wxDC &dc, wxRect &rc)
{
	wxPen oldpen = dc.GetPen();
	wxPen pen( IsSelected() ? *wxBLACK_PEN : *wxMEDIUM_GREY_PEN );
	pen.SetWidth(IsSelected() ? 2 : 1);
	dc.SetPen( pen );

	wxBrush oldBrush = dc.GetBrush();
	wxBrush brush(m_color, NULL!=m_pInput ? wxSOLID : wxTRANSPARENT);
	dc.SetBrush(brush);

	int x = rc.GetX();
	int y = rc.GetY();
	int w = rc.GetWidth();
	int h = rc.GetHeight();
	int n = 0;

	wxPoint points[6];

	if(NULL != m_pInput)
	{
		points[0] = wxPoint(x,								y);
		points[1] = wxPoint(x+w-GAP_LENGTH,					y);
		points[2] = wxPoint(x+w+CORNER_LENGTH-GAP_LENGTH,	y+h/2);
		points[3] = wxPoint(x+w-GAP_LENGTH,					y+h);
		points[4] = wxPoint(x,								y+h);
		points[5] = wxPoint(x+CORNER_LENGTH,				y+h/2);

		n = m_bFirst ? 5 : 6;
	}
	else
	{
		// Last component: mixer
		points[0] = wxPoint(x,					y);
		points[1] = wxPoint(x+w,				y);
		points[2] = wxPoint(x+w,				y+h);
		points[3] = wxPoint(x,					y+h);
		points[4] = wxPoint(x+CORNER_LENGTH,	y+h/2);

		n = 5;
	}

	if(m_pRegion)
		delete m_pRegion;
	m_pRegion = new wxRegion(n, points);

	dc.DrawPolygon(n, points);

	dc.SetBrush( oldBrush );
	dc.SetPen(oldpen);
}
开发者ID:sqba,项目名称:floopy,代码行数:51,代码来源:pathctrl.cpp

示例9: draw_xtics

/// draw x axis tics
void FPlot::draw_xtics (wxDC& dc, Rect const &v, bool set_pen)
{
    if (set_pen) {
        dc.SetPen(wxPen(xAxisCol, pen_width));
        dc.SetTextForeground(xAxisCol);
    }
    set_font(dc, ticsFont);
    // get tics text height
    wxCoord h;
    dc.GetTextExtent(wxT("1234567890"), 0, &h);

    vector<double> minors;
    vector<double> x_tics = scale_tics_step(v.left(), v.right(), x_max_tics,
                                            minors, xs.logarithm);

    //if x axis is visible tics are drawed at the axis,
    //otherwise tics are drawed at the bottom edge of the plot
    const int pixel_height = get_pixel_height(dc);
    int Y = pixel_height - h;
    if (x_axis_visible && !ys.logarithm && ys.px(0) >= 0 && ys.px(0) < Y)
        Y = ys.px(0);
    for (vector<double>::const_iterator i = x_tics.begin();
                                                    i != x_tics.end(); ++i) {
        int X = xs.px(*i);
        dc.DrawLine (X, Y, X, Y - x_tic_size);
        wxString label = format_label(*i, v.right() - v.left());
        wxCoord w;
        dc.GetTextExtent (label, &w, 0);
        dc.DrawText (label, X - w/2, Y + 1);
        if (x_grid) {
            wxPen pen = dc.GetPen();
            pen.SetStyle(wxPENSTYLE_DOT);
            wxDCPenChanger pen_changer(dc, pen);
            dc.DrawLine(X, 0, X, Y);
            dc.DrawLine(X, Y+1+h, X, pixel_height);
            /*
            draw_line_with_style(dc, wxPENSTYLE_DOT, X, 0, X, Y);
            draw_line_with_style(dc, wxPENSTYLE_DOT, X, Y+1+h, X, pixel_height);
            */
        }
    }
    //draw minor tics
    if (xminor_tics_visible)
        for (vector<double>::const_iterator i = minors.begin();
                                                    i != minors.end(); ++i) {
            int X = xs.px(*i);
            dc.DrawLine (X, Y, X, Y - x_tic_size);
        }
}
开发者ID:darckense,项目名称:fityk,代码行数:50,代码来源:plot.cpp

示例10: OnDrawItem

// draws a line of symbols
void wxSymbolListCtrl::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{
    wxColour oldTextColour = dc.GetTextForeground();
    int startSymbol = n*m_symbolsPerLine;

    int i;
    for (i = 0; i < m_symbolsPerLine; i++)
    {
        bool resetColour = false;
        int symbol = startSymbol+i;
        if (symbol == m_current)
        {
            dc.SetBrush(wxBrush(m_colBgSel));

            dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
            resetColour = true;

            wxPen oldPen = dc.GetPen();
            dc.SetPen(*wxTRANSPARENT_PEN);

            dc.DrawRectangle(rect.x + i*m_cellSize.x, rect.y, m_cellSize.x, rect.y+rect.height);
            dc.SetPen(oldPen);
        }

        // Don't draw first line
        if (i != 0)
            dc.DrawLine(rect.x + i*m_cellSize.x, rect.y, i*m_cellSize.x, rect.y+rect.height);

        if (symbol >= m_minSymbolValue && symbol <= m_maxSymbolValue)
        {
            wxString text;
            text << (wxChar) symbol;

            wxCoord w, h;
            dc.GetTextExtent(text, & w, & h);

            int x = rect.x + i*m_cellSize.x + (m_cellSize.x - w)/2;
            int y = rect.y + (m_cellSize.y - h)/2;
            dc.DrawText(text, x, y);
        }

        if (resetColour)
            dc.SetTextForeground(oldTextColour);
    }

    // Draw horizontal separator line
    dc.DrawLine(rect.x, rect.y+rect.height-1, rect.x+rect.width, rect.y+rect.height-1);
}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:49,代码来源:richtextsymboldlg.cpp

示例11: DrawBG

void CFloopyControl::DrawBG(wxDC& dc, wxRect& rc)
{
	wxBrush oldBrush = dc.GetBrush();
	wxPen oldpen = dc.GetPen();

	wxPen pen( *wxLIGHT_GREY );
	pen.SetWidth(1);
	dc.SetPen( pen );

	wxBrush brush(GetParent()->GetColor(), wxSOLID);
	dc.SetBrush(brush);

	dc.DrawRoundedRectangle(rc.GetX(), rc.GetTop(),
		rc.GetWidth(), rc.GetHeight(), 2);

	dc.SetPen(oldpen);
	dc.SetBrush( oldBrush );
}
开发者ID:sqba,项目名称:floopy,代码行数:18,代码来源:floopycontrol.cpp

示例12: _Draw_Box

//---------------------------------------------------------
inline void CWKSP_Layer_Legend::_Draw_Box(wxDC &dc, int y, int dy, wxColour Color)
{
	wxPen	Pen;
	wxBrush	Brush;

	//-----------------------------------------------------
	_Set_Size(0, dy);

	dy	-= BOX_SPACE;

	//-----------------------------------------------------
	if( m_Box_bOutline == false )
	{
		Pen		= dc.GetPen();
		Pen.SetColour(Color);
		dc.SetPen(Pen);
	}

	if( m_Box_bFill )
	{
		Brush	= dc.GetBrush();
		Brush.SetColour(Color);
		dc.SetBrush(Brush);
	}

	//-----------------------------------------------------
	switch( m_BoxStyle )
	{
	case BOXSTYLE_LINE:
		dc.DrawLine(m_xBox                  , y + dy / 2, m_xBox +     m_dxBox / 4, y);
		dc.DrawLine(m_xBox +     m_dxBox / 4, y         , m_xBox + 3 * m_dxBox / 4, y + dy);
		dc.DrawLine(m_xBox + 3 * m_dxBox / 4, y + dy    , m_xBox +     m_dxBox    , y + dy / 2);
		break;

	case BOXSTYLE_CIRCLE:
		dc.DrawCircle(m_xBox + m_dxBox / 2, y + dy / 2, dy / 2);
		break;

	case BOXSTYLE_RECT:	default:
		dc.DrawRectangle(m_xBox, y, m_dxBox, dy);
		break;
	}
}
开发者ID:am2222,项目名称:SAGA-GIS,代码行数:44,代码来源:wksp_layer_legend.cpp

示例13: drawIndicatorAtArea

void StateEvaluationTreePanel::drawIndicatorAtArea(wxDC &DC,
                                                   IndicatorStyle const &Style,
                                                   wxCoord X, wxCoord Y,
                                                   wxCoord W, wxCoord H)
{
  auto const Kind = Style.GetKind();
  auto const FG   = Style.GetForeground();
  
  wxPen const PrevPen = DC.GetPen();
  wxBrush const PrevBrush = DC.GetBrush();
  
  switch (Kind) {
    case IndicatorStyle::EKind::Plain:
      DC.SetPen(wxPen{FG, Settings.PenWidth});
      DC.DrawLine(X, Y+H, X+W, Y+H);
      break;
    case IndicatorStyle::EKind::Box:
      DC.SetPen(wxPen{FG, Settings.PenWidth});
      DC.DrawRectangle(X, Y, W, H);
      break;
    case IndicatorStyle::EKind::StraightBox:
      // Many DCs don't support alpha at all, so manually calculate an alpha
      // against the background colour.
      auto const BG = PrevBrush.GetColour();
      double const Alpha        = (double)Style.GetAlpha() / 255;
      double const OutlineAlpha = (double)Style.GetOutlineAlpha() / 255;
      DC.SetPen(wxPen{
        wxColour(wxColour::AlphaBlend(FG.Red(), BG.Red(), OutlineAlpha),
                 wxColour::AlphaBlend(FG.Green(), BG.Green(), OutlineAlpha),
                 wxColour::AlphaBlend(FG.Blue(), BG.Blue(), OutlineAlpha)),
        Settings.PenWidth});
      DC.SetBrush(wxBrush{
        wxColour(wxColour::AlphaBlend(FG.Red(), BG.Red(), Alpha),
                 wxColour::AlphaBlend(FG.Green(), BG.Green(), Alpha),
                 wxColour::AlphaBlend(FG.Blue(), BG.Blue(), Alpha))});
      DC.DrawRectangle(X, Y, W, H);
      break;
  }
  
  DC.SetPen(PrevPen);
  DC.SetBrush(PrevBrush);
}
开发者ID:mheinsen,项目名称:seec,代码行数:42,代码来源:StateEvaluationTree.cpp

示例14: PaintStraightGradientBox

void DrawingUtils::PaintStraightGradientBox(wxDC& dc,
        const wxRect& rect,
        const wxColour& startColor,
        const wxColour& endColor,
        bool  vertical)
{
    int rd, gd, bd, high = 0;
    rd = endColor.Red() - startColor.Red();
    gd = endColor.Green() - startColor.Green();
    bd = endColor.Blue() - startColor.Blue();

    /// Save the current pen and brush
    wxPen savedPen = dc.GetPen();
    wxBrush savedBrush = dc.GetBrush();

    if ( vertical )
        high = rect.GetHeight()-1;
    else
        high = rect.GetWidth()-1;

    if ( high < 1 )
        return;

    for (int i = 0; i <= high; ++i) {
        int r = startColor.Red() +  ((i*rd*100)/high)/100;
        int g = startColor.Green() + ((i*gd*100)/high)/100;
        int b = startColor.Blue() + ((i*bd*100)/high)/100;

        wxPen p(wxColor(r, g, b));
        dc.SetPen(p);

        if ( vertical )
            dc.DrawLine(rect.x, rect.y+i, rect.x+rect.width, rect.y+i);
        else
            dc.DrawLine(rect.x+i, rect.y, rect.x+i, rect.y+rect.height);
    }

    /// Restore the pen and brush
    dc.SetPen( savedPen );
    dc.SetBrush( savedBrush );
}
开发者ID:Hmaal,项目名称:codelite,代码行数:41,代码来源:drawingutils.cpp

示例15: _Draw_Regression

//---------------------------------------------------------
void CVIEW_ScatterPlot::_Draw_Regression(wxDC &dc, wxRect r)
{
	wxPen	oldPen	= dc.GetPen();

	dc.SetPen(wxPen(
		m_Options("REG_COLOR")->asColor(),
		m_Options("REG_SIZE" )->asInt()
	));

	//-----------------------------------------------------
	double	dx	= (r.GetWidth () - 1.) / m_Trend.Get_Data_XStats().Get_Range();
	double	dy	= (r.GetHeight() - 1.) / m_Trend.Get_Data_YStats().Get_Range();

	//-----------------------------------------------------
	dc.DrawCircle(
		GET_DC_X(m_Trend.Get_Data_XStats().Get_Mean()),
		GET_DC_Y(m_Trend.Get_Data_YStats().Get_Mean()), 2
	);

	double	ex	= m_Trend.Get_Data_XStats().Get_Range() / (double)r.GetWidth();
	double	x	= m_Trend.Get_Data_XMin();

	for(int ix=0, ay, by=0; ix<r.GetWidth(); ix++, x+=ex)
	{
		double	y	= m_Trend.Get_Value(x);

		ay	= by; by = r.GetBottom() - (int)(dy * (y - m_Trend.Get_Data_YMin()));

		if( ix > 0 && r.GetTop() < ay && ay < r.GetBottom() && r.GetTop() < by && by < r.GetBottom() )
		{
			dc.DrawLine(r.GetLeft() + ix - 1, ay, r.GetLeft() + ix, by);
		}
	}

	dc.SetPen(oldPen);

	//-----------------------------------------------------
	Draw_Text(dc, TEXTALIGN_BOTTOMCENTER, r.GetLeft() + r.GetWidth() / 2, r.GetTop(),
		m_Trend.Get_Formula(SG_TREND_STRING_Compact).c_str()
	);
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:42,代码来源:view_scatterplot.cpp


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