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


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

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


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

示例1: PaintCustomColour

void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
{
#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
    wxUnusedVar(dc);

    wxBitmap bmp(m_singleCustomColourRect.GetSize(), 32);
    bmp.UseAlpha();
    DoPreviewBitmap(bmp, m_colourData.GetColour());
    m_customColourBmp->SetBitmap(bmp);
#else
    dc.SetPen(*wxBLACK_PEN);

    wxBrush *brush = new wxBrush(m_colourData.GetColour());
    dc.SetBrush(*brush);

    dc.DrawRectangle(m_singleCustomColourRect);

    dc.SetBrush(wxNullBrush);
    delete brush;
#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA/!wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
}
开发者ID:Teodorrrro,项目名称:wxWidgets,代码行数:21,代码来源:colrdlgg.cpp

示例2: DrawConnection

void Connection::DrawConnection(wxDC& dc, wxPoint Start, wxPoint End)
{
	int Smooth=10;
	float inc = 1.0/(Smooth*2);
	wxPoint inter1,inter2;
	inter1.y=Start.y;
	inter1.x=Start.x+(End.x-Start.x)/2;

	inter2.y=End.y;
	inter2.x=End.x+(Start.x-End.x)/2;

	dc.SetBrush(wxBrush());
	dc.SetPen(wxPen());
	for (float i=0;i<1;i+=inc)
	{
		wxPoint l1,l2;
		l1=_Bezier(Start,End,inter1,inter2,i);
		l2=_Bezier(Start,End,inter1,inter2,i+inc);
		dc.DrawLine(l1.x,l1.y,l2.x,l2.y);
	}
}
开发者ID:thennequin,项目名称:InitialProject,代码行数:21,代码来源:Connection.cpp

示例3: PaintBasicColours

void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
{
    int i;
    for (i = 0; i < 6; i++)
    {
        int j;
        for (j = 0; j < 8; j++)
        {
            int ptr = i*8 + j;

            int x = (j*(m_smallRectangleSize.x+m_gridSpacing) + m_standardColoursRect.x);
            int y = (i*(m_smallRectangleSize.y+m_gridSpacing) + m_standardColoursRect.y);

            dc.SetPen(*wxBLACK_PEN);
            wxBrush brush(m_standardColours[ptr]);
            dc.SetBrush(brush);

            dc.DrawRectangle( x, y, m_smallRectangleSize.x, m_smallRectangleSize.y);
        }
    }
}
开发者ID:Teodorrrro,项目名称:wxWidgets,代码行数:21,代码来源:colrdlgg.cpp

示例4: Draw

bool DragShape::Draw(wxDC& dc, bool highlight)
{
    if (m_bitmap.IsOk())
    {
        wxMemoryDC memDC;
        memDC.SelectObject(m_bitmap);

        dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(),
            & memDC, 0, 0, wxCOPY, true);

        if (highlight)
        {
            dc.SetPen(*wxWHITE_PEN);
            dc.SetBrush(*wxTRANSPARENT_BRUSH);
            dc.DrawRectangle(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight());
        }

        return true;
    }
    else
        return false;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:22,代码来源:dragimag.cpp

示例5: DrawBackground

void wxAuiMSWTabArt::DrawBackground(wxDC& dc,
    wxWindow* wnd,
    const wxRect& rect)
{
    if ( !IsThemed() )
    {
        wxAuiGenericTabArt::DrawBackground(dc, wnd, rect);
        return;
    }

    int borderHeight = 2;

    wxRect drawRect = rect;
    drawRect.height -= borderHeight;

    // Draw background
    dc.SetBrush(wxBrush(wnd->GetBackgroundColour()));
    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.DrawRectangle(drawRect);

    // Draw top border
    drawRect.y = drawRect.height;
    drawRect.height = borderHeight + 2;

    drawRect.Inflate(1, 0);

    RECT r;
    wxCopyRectToRECT(drawRect, r);

    wxUxThemeHandle hTheme(wnd, L"TAB");

    ::DrawThemeBackground(
        hTheme,
        GetHdcOf(dc.GetTempHDC()),
        TABP_PANE,
        0,
        &r,
        NULL);
}
开发者ID:oneeyeman1,项目名称:wxWidgets,代码行数:39,代码来源:tabartmsw.cpp

示例6: wxRibbonDrawParallelGradientLines

void wxRibbonDrawParallelGradientLines(wxDC& dc,
                                    int nlines,
                                    const wxPoint* line_origins,
                                    int stepx,
                                    int stepy,
                                    int numsteps,
                                    int offset_x,
                                    int offset_y,
                                    const wxColour& start_colour,
                                    const wxColour& end_colour)
{
    int rd, gd, bd;
    rd = end_colour.Red() - start_colour.Red();
    gd = end_colour.Green() - start_colour.Green();
    bd = end_colour.Blue() - start_colour.Blue();

    for (int step = 0; step < numsteps; ++step)
    {
        int r,g,b;

        r = start_colour.Red() + (((step*rd*100)/numsteps)/100);
        g = start_colour.Green() + (((step*gd*100)/numsteps)/100);
        b = start_colour.Blue() + (((step*bd*100)/numsteps)/100);

        wxPen p(wxColour((unsigned char)r,
                        (unsigned char)g,
                        (unsigned char)b));
        dc.SetPen(p);

        for(int n = 0; n < nlines; ++n)
        {
            dc.DrawLine(offset_x + line_origins[n].x, offset_y + line_origins[n].y,
                        offset_x + line_origins[n].x + stepx, offset_y + line_origins[n].y + stepy);
        }

        offset_x += stepx;
        offset_y += stepy;
    }
}
开发者ID:beanhome,项目名称:dev,代码行数:39,代码来源:art_internal.cpp

示例7: DrawBackground

void SjVisGrBg::DrawBackground(wxDC& dc)
{
	// blue gradient background
	wxSize size = dc.GetSize();
	int rowH = (m_height/BG_STEPS)+1, y, yCol;
	dc.SetPen(*wxTRANSPARENT_PEN);
	for( y = 0; y < BG_STEPS; y++ )
	{
		if( m_imgOpFlags & SJ_IMGOP_GRAYSCALE )
		{
			yCol = int(float(y)*BG_GRAYSCALE);
			m_brush.SetColour(yCol, yCol, yCol);
		}
		else
		{
			m_brush.SetColour(0, 0, y);
		}

		dc.SetBrush(m_brush);
		dc.DrawRectangle(0, y*rowH, size.x, rowH);
	}
}
开发者ID:boh1996,项目名称:silverjuke,代码行数:22,代码来源:vis_bg.cpp

示例8: OnDrawBackground

void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
{
    // we need to render selected and current items differently
    const bool isSelected = IsSelected(n),
               isCurrent = IsCurrent(n);
    if ( isSelected || isCurrent )
    {
        if ( isSelected )
        {
            dc.SetBrush(wxBrush(m_colBgSel, wxSOLID));
        }
        else // !selected
        {
            dc.SetBrush(*wxTRANSPARENT_BRUSH);
        }

        dc.SetPen(*(isCurrent ? wxBLACK_PEN : wxTRANSPARENT_PEN));

        dc.DrawRectangle(rect);
    }
    //else: do nothing for the normal items
}
开发者ID:hgwells,项目名称:tive,代码行数:22,代码来源:vlbox.cpp

示例9: Stroke

void SkinRegion::Stroke(wxDC& dc, wxGraphicsContext* gc, const wxRect& rect, int /*n*/)
{
    if (!has_border)
        return;

    int penw = border.GetWidth() / 2.0f;

    wxRect r(rect);
    r.Deflate(penw, penw);
    //border.SetCap(wxCAP_PROJECTING);

    if (rounded) {
        bool needsDelete = false;
        if (!gc) {
            gc = wxGraphicsContext::Create((wxWindowDC&)dc);
            needsDelete = true;
        }

        gc->SetBrush(*wxTRANSPARENT_BRUSH);
        gc->SetPen(border);
        gc->DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, rounded * .97);

        rect.Inflate(penw, penw);

        if (needsDelete)
            delete gc;
    } else {
        dc.SetPen(border);

        int offset = (int)(border.GetWidth() % 2 == 0);
        wxPoint x(offset, 0);
        wxPoint y(0, offset);

        dc.DrawLine(rect.GetTopLeft(), rect.GetBottomLeft() + y);
        dc.DrawLine(rect.GetBottomLeft() + y, rect.GetBottomRight() + y + x);
        dc.DrawLine(rect.GetBottomRight() + y + x, rect.GetTopRight() + x);
        dc.DrawLine(rect.GetTopRight() + x, rect.GetTopLeft());
    }
}
开发者ID:Esteban-Rocha,项目名称:digsby,代码行数:39,代码来源:skinobjects.cpp

示例10: DrawBackground

void wxAuiGenericTabArt::DrawBackground(wxDC& dc,
                                        wxWindow* WXUNUSED(wnd),
                                        const wxRect& rect)
{
    // draw background

    wxColor top_color       = m_baseColour.ChangeLightness(90);
    wxColor bottom_color   = m_baseColour.ChangeLightness(170);
    wxRect r;

   if (m_flags &wxAUI_NB_BOTTOM)
       r = wxRect(rect.x, rect.y, rect.width+2, rect.height);
   // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
   // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
   else //for wxAUI_NB_TOP
       r = wxRect(rect.x, rect.y, rect.width+2, rect.height-3);

    dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);


   // draw base lines

   dc.SetPen(m_borderPen);
   int y = rect.GetHeight();
   int w = rect.GetWidth();

   if (m_flags &wxAUI_NB_BOTTOM)
   {
       dc.SetBrush(wxBrush(bottom_color));
       dc.DrawRectangle(-1, 0, w+2, 4);
   }
   // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
   // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
   else //for wxAUI_NB_TOP
   {
       dc.SetBrush(m_baseColourBrush);
       dc.DrawRectangle(-1, y-4, w+2, 4);
   }
}
开发者ID:futurepr0n,项目名称:wxWidgets,代码行数:39,代码来源:tabart.cpp

示例11: DrawGridLines

void wxMultiCellSizer :: DrawGridLines(wxDC& dc)
{
    RecalcSizes();
    int maxW = Sum(m_maxWidth, m_cell_count.GetWidth());
    int maxH = Sum(m_maxHeight, m_cell_count.GetHeight());
    int x;

    // Draw the columns
    dc.SetPen(* m_pen);
    for (x = 1; x < m_cell_count.GetWidth(); x++)
    {
        int colPos = Sum(m_maxWidth, x) ;
        dc.DrawLine(colPos, 0, colPos, maxH);
    }

    // Draw the rows
    for (x = 1; x < m_cell_count.GetHeight(); x++)
    {
        int rowPos = Sum(m_maxHeight, x);
        dc.DrawLine(0, rowPos, maxW, rowPos);
    }
}
开发者ID:nealey,项目名称:vera,代码行数:22,代码来源:multicell.cpp

示例12: DrawSectors

void kwxAngularMeter::DrawSectors(wxDC &dc)
{
	double starc,endarc;
	int secount,dx,dy;
	int w,h ;

	double val;
	
	GetClientSize(&w,&h);

	//arco -> settori
	dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxSOLID));

	starc = m_nAngleStart;
	endarc = starc + ((m_nAngleEnd - m_nAngleStart) / (double)m_nSec);
	//dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*wxRED,wxSOLID));
	for(secount=0;secount<m_nSec;secount++)
	{
		dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_aSectorColor[secount],wxSOLID));
		dc.DrawEllipticArc(0,0,w,h,180 - endarc,180 - starc);
		//dc.DrawEllipticArc(0,0,w,h,0,180);
		starc = endarc;
		endarc += ((m_nAngleEnd - m_nAngleStart) / (double)m_nSec);
	}

	val = (m_nAngleStart * m_dPI) / 180.0;
	dx = static_cast<int>(cos(val) * h / 2.0);
	dy = static_cast<int>(sin(val) * h / 2.0);

	dc.DrawLine(w / 2, h / 2, (w / 2) - dx, (h / 2) - dy);	//linea sinistra

	val = (m_nAngleEnd * m_dPI) / 180.0;
	dx = static_cast<int>(cos(val) * h / 2.0);
	dy = static_cast<int>(sin(val) * h / 2.0);
		
	dc.DrawLine(w / 2, h / 2, (w / 2) - dx, (h / 2) - dy);	//linea destra

}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:38,代码来源:angularmeter.cpp

示例13: draw

void wxMaze::draw(wxDC & dc, int w, int h, unsigned int m_x, unsigned int m_y) const
{
	dc.SetPen(*wxBLACK_PEN);
	dc.DrawRectangle(0, 0, w, h);

/* {{{ DISABLED: copy from ASCIIMaze
	for (unsigned int j = 0; j < ny(); ++j) {
		for (unsigned int i = 0; i < nx(); ++i) {
			cout << wall;
			if (j == 0) {
				cout << ((c(i, j) & TOP) ? wall : space);
			} else {
				cout << (((c(i, j) & TOP) && (c(i, j-1) & BOTTOM)) ? wall : space);
			}
		}
		cout << wall << endl;
		for (unsigned int i = 0; i < nx(); ++i) {
			if (i == 0) {
				cout << ((c(i, j) & LEFT) ? wall : space);
			} else {
				cout << (((c(i, j) & LEFT) && (c(i-1, j) & RIGHT)) ? wall : space);
			}
			if (m_x == (unsigned int)-1 || m_y == (unsigned int)-1) {
				cout << center;
			} else {
				cout << ((i == m_x && j == m_y) ? mark : center);
			}
		}
		cout << ((c(nx()-1, j) & RIGHT) ? wall : space);
		cout << endl;
	}
	for (unsigned int i = 0; i < nx(); ++i) {
		cout << wall;
		cout << ((c(i, ny()-1) & BOTTOM) ? wall : space);
	}
	cout << wall << endl;
}}} */
}
开发者ID:mariokonrad,项目名称:maze,代码行数:38,代码来源:wxmaze.cpp

示例14: Render

/**
 * Render the event in the bitmap
 */
void GroupEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    wxString groupTitle = name.empty() ? _("Untitled group") : wxString(name);
    wxColour backgroundColor = wxColour(colorR, colorG, colorB);
    wxColour textColor = colorR + colorG + colorB > 200*3 ? *wxBLACK : *wxWHITE;
    if (IsDisabled())
    {
        backgroundColor.MakeDisabled();
        textColor = wxColour(160, 160, 160);
    }

    dc.SetBrush(wxBrush(backgroundColor));
    dc.SetPen(wxPen(backgroundColor.ChangeLightness(70)));
    wxRect rect(x+1, y, width-2, GetRenderedHeight(width, platform)-2);
    dc.DrawRectangle(rect);

    dc.SetTextBackground(backgroundColor);
    dc.SetTextForeground(textColor);
    dc.SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) );
    dc.DrawText( groupTitle, x+5, y + 5 );
#endif
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:26,代码来源:GroupEvent.cpp

示例15: render

void UIElementPrimitive::render(wxDC& dc)
{
	int client_h = 0;
	int client_w = 0;
	GetClientSize (&client_w, &client_h);

	if (!(cpw::ApplicationConfiguration::GetInstance()->IsThemed()))
	{
	  wxColour c_pen   = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8);
	  wxColour c_backg = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8);	
	wxColour c_brush = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8);
dc.SetTextForeground(wxColour(wxString(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8)));
		dc.SetPen(wxPen(c_pen));
		dc.SetBrush(wxBrush(c_brush));
		dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH);
	}

	dc.DrawRotatedText(_T("Name: "),20,20, 0);
	dc.DrawRotatedText(_T("Model: "),20,40, 0);
	dc.DrawRotatedText(_T("Icon:"),20,60, 0);
	dc.DrawRotatedText(_T("Font:"),20,80, 0);
	dc.DrawRotatedText(_T("Description"),20,100, 0);
}
开发者ID:BackupTheBerlios,项目名称:rvzware,代码行数:23,代码来源:UIElementPrimitive.cpp


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