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


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

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


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

示例1: OnDraw

void wxRectangleShape::OnDraw(wxDC &dc)
{
	double x1 = (double)(m_xpos - m_width / 2.0);
	double y1 = (double)(m_ypos - m_height / 2.0);

	if (m_shadowMode != SHADOW_NONE)
	{
		if (m_shadowBrush)
			dc.SetBrush(* m_shadowBrush);
		dc.SetPen(* g_oglTransparentPen);

		if (m_cornerRadius != 0.0)
			dc.DrawRoundedRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY),
			                        WXROUND(m_width), WXROUND(m_height), m_cornerRadius);
		else
			dc.DrawRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY), WXROUND(m_width), WXROUND(m_height));
	}

	if (m_pen)
	{
		if (m_pen->GetWidth() == 0)
			dc.SetPen(* g_oglTransparentPen);
		else
			dc.SetPen(* m_pen);
	}
	if (m_brush)
		dc.SetBrush(* m_brush);

	if (m_cornerRadius != 0.0)
		dc.DrawRoundedRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height), m_cornerRadius);
	else
		dc.DrawRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height));
}
开发者ID:kleopatra999,项目名称:pgadmin3,代码行数:33,代码来源:basic2.cpp

示例2: DrawNullCard

//+-------------------------------------------------------------+
//| Card::DrawNullCard()                                        |
//+-------------------------------------------------------------+
//| Description:                                                |
//| Draws the outline of a card at (x, y).                      |
//| Used to draw place holders for empty piles of cards.        |
//+-------------------------------------------------------------+
void Card::DrawNullCard(wxDC& dc, int x, int y)
{
    wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour(), 1, wxSOLID);
    dc.SetBrush(FortyApp::BackgroundBrush());
    dc.SetPen(*pen);
    dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
} // Card::DrawNullCard()
开发者ID:dariusliep,项目名称:LogViewer,代码行数:14,代码来源:card.cpp

示例3: OnDraw

// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
    dc.SetFont(*wxSWISS_FONT);
    dc.SetPen(*wxGREEN_PEN);
    dc.DrawLine(0, 0, 200, 200);
    dc.DrawLine(200, 0, 0, 200);

    dc.SetBrush(*wxCYAN_BRUSH);
    dc.SetPen(*wxRED_PEN);
    dc.DrawRectangle(100, 100, 100, 50);
    dc.DrawRoundedRectangle(150, 150, 100, 50, 20);

    dc.DrawEllipse(250, 250, 100, 50);
#if wxUSE_SPLINES
    dc.DrawSpline(50, 200, 50, 100, 200, 10);
#endif // wxUSE_SPLINES
    dc.DrawLine(50, 230, 200, 230);
    dc.DrawText(wxT("This is a test string"), 50, 230);

    wxPoint points[3];
    points[0].x = 200; points[0].y = 300;
    points[1].x = 100; points[1].y = 400;
    points[2].x = 300; points[2].y = 400;

    dc.DrawPolygon(3, points);
}
开发者ID:euler0,项目名称:Helium,代码行数:27,代码来源:sashtest.cpp

示例4: BenchmarkRoundedRectangles

    void BenchmarkRoundedRectangles(const wxString& msg, wxDC& dc)
    {
        if ( !opts.testRectangles )
            return;

        if ( opts.mapMode != 0 )
            dc.SetMapMode((wxMappingMode)opts.mapMode);
        if ( opts.penWidth != 0 )
            dc.SetPen(wxPen(*wxWHITE, opts.penWidth));

        dc.SetBrush( *wxCYAN_BRUSH );

        wxPrintf("Benchmarking %s: ", msg);
        fflush(stdout);

        wxStopWatch sw;
        for ( int n = 0; n < opts.numIters; n++ )
        {
            int x = rand() % opts.width,
                y = rand() % opts.height;

            dc.DrawRoundedRectangle(x, y, 48, 32, 8);
        }

        const long t = sw.Time();

        wxPrintf("%ld rounded rects done in %ldms = %gus/rect\n",
                 opts.numIters, t, (1000. * t)/opts.numIters);
    }
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:29,代码来源:graphics.cpp

示例5: RenderCheckBox

void clRowEntry::RenderCheckBox(wxWindow* win, wxDC& dc, const clColours& colours, const wxRect& rect, bool checked)
{
#if 1
    wxUnusedVar(win);
    wxUnusedVar(colours);
    wxRendererNative::Get().DrawCheckBox(win, dc, rect, checked ? wxCONTROL_CHECKED : wxCONTROL_NONE);
#else
    dc.SetPen(wxPen(colours.GetBorderColour(), 2));
    dc.SetBrush(checked ? colours.GetBorderColour() : *wxTRANSPARENT_BRUSH);
    dc.DrawRoundedRectangle(rect, 2.0);
    if(checked) {
        wxRect innerRect = rect;
        innerRect.Deflate(5);
        const wxColour& penColour = IsSelected() ? colours.GetSelItemTextColour() : colours.GetDarkBorderColour();
        dc.SetPen(wxPen(penColour, 3));

        wxPoint p1, p2, p3;
        p1.x = innerRect.GetTopLeft().x;
        p1.y = innerRect.GetTopLeft().y + (innerRect.GetHeight() / 2);

        p2.x = innerRect.GetBottomLeft().x + (innerRect.GetWidth() / 3);
        p2.y = innerRect.GetBottomLeft().y;

        p3 = innerRect.GetTopRight();
        dc.DrawLine(p1, p2);
        dc.DrawLine(p2, p3);
    }
#endif
}
开发者ID:eranif,项目名称:codelite,代码行数:29,代码来源:clRowEntry.cpp

示例6: 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

示例7: DrawHeaderButton

 // draw the header control button (used by wxListCtrl)
 virtual void DrawHeaderButton(wxWindow *win,
                               wxDC& dc,
                               const wxRect& rect,
                               int flags = 0)
 {
     dc.SetBrush(*wxCYAN_BRUSH);
     dc.SetTextForeground(*wxRED);
     dc.DrawRoundedRectangle(rect, 10);
     dc.DrawLabel(_T("MyDllRenderer"), wxNullBitmap, rect, wxALIGN_CENTER);
 }
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:11,代码来源:renddll.cpp

示例8: drawIsoLineLabels

void IsoLine::drawIsoLineLabels(GRIBOverlayFactory *pof, wxDC &dc, wxColour text_color, wxColour back_color,
                                PlugIn_ViewPort *vp, int density, int first, double coef)
{
///
//#if 0
    std::list<Segment *>::iterator it;
    int nb = first;
    wxString label;

    label.Printf(_T("%d"), (int)(value*coef+0.5));

    wxPen penText(text_color);

    int w, h;
    dc.GetTextExtent(label, &w, &h);

    dc.SetPen(penText);
    dc.SetBrush(wxBrush(back_color));
    dc.SetTextForeground(text_color);
    dc.SetTextBackground(back_color);

    //---------------------------------------------------------
    // Ecrit les labels
    //---------------------------------------------------------
    for (it=trace.begin(); it!=trace.end(); it++,nb++)
    {
        if (nb % density == 0)
		{
            Segment *seg = *it;

//            if(vp->vpBBox.PointInBox((seg->px1 + seg->px2)/2., (seg->py1 + seg->py2)/2., 0.))
            {
 //                 wxPoint ab = vp->GetMercatorPixFromLL(seg->py1, seg->px1);
 //                 wxPoint cd = vp->GetMercatorPixFromLL(seg->py2, seg->px2);
			wxPoint ab;
			GetCanvasPixLL(vp, &ab, seg->py1, seg->px1);
			wxPoint cd;
			GetCanvasPixLL(vp, &cd, seg->py1, seg->px1);
                  
			int label_offset = 6;
                  int xd = (ab.x + cd.x-(w+label_offset * 2))/2;
                  int yd = (ab.y + cd.y - h)/2;

                 
                  dc.DrawRoundedRectangle(xd, yd, w+(label_offset * 2), h, -.25);
                  dc.DrawText(label, label_offset/2 + xd, yd-1);
            }

        }
    }
//#endif
///
}
开发者ID:fzschornack,项目名称:OpenCPN,代码行数:53,代码来源:IsoLine.cpp

示例9: drawDigit

void CFreqDisplay::drawDigit(wxDC& dc, int width, int height, int thickness, int x, int y, unsigned int n, bool dot)
{
	wxASSERT(width > 0);
	wxASSERT(height > 0);
	wxASSERT(thickness > 0);
	wxASSERT(x >= 0);
	wxASSERT(y >= 0);
	wxASSERT(n >= 0 && n <= 9);

	int radius = thickness / 2;;

	int topSpace    = 3;
	int bottomSpace = 3 + thickness;

	int leftSpace  = 3 + thickness;
	int rightSpace = 3 + thickness;

	int barWidth  = width - leftSpace - rightSpace;
	int barHeight = (height - topSpace - bottomSpace) / 2;

	const int BODGE_FACTOR = 2;

	dc.SetPen(wxPen(m_lightColour));
	dc.SetBrush(wxBrush(m_lightColour));

	if (dot)
		dc.DrawRoundedRectangle(x + 2, y + topSpace + 2 * barHeight, thickness, thickness, radius);

	if (n == 0 || n == 2 || n == 3 || n == 5 || n == 6 || n == 7 || n == 8 || n == 9)
		dc.DrawRoundedRectangle(x + leftSpace + BODGE_FACTOR, y + topSpace, barWidth, thickness, radius);

	if (n == 0 || n == 4 || n == 5 || n == 6 || n == 8 || n == 9)
		dc.DrawRoundedRectangle(x + leftSpace, y + topSpace + BODGE_FACTOR, thickness, barHeight, radius);

	if (n == 0 || n == 1 || n == 2 || n == 3 || n == 4 || n == 7 || n == 8 || n == 9)
		dc.DrawRoundedRectangle(x + leftSpace + barWidth, y + topSpace + BODGE_FACTOR, thickness, barHeight, radius);

	if (n == 2 || n == 3 || n == 4 || n == 5 || n == 6 || n == 8 || n == 9)
		dc.DrawRoundedRectangle(x + leftSpace + BODGE_FACTOR, y + topSpace + barHeight, barWidth, thickness, radius);

	if (n == 0 || n == 2 || n == 6 || n == 8)
		dc.DrawRoundedRectangle(x + leftSpace, y + topSpace + barHeight + BODGE_FACTOR, thickness, barHeight, radius);

	if (n == 0 || n == 1 || n == 3 || n == 4 || n == 5 || n == 6 || n == 7 || n == 8 || n == 9)
		dc.DrawRoundedRectangle(x + leftSpace + barWidth, y + topSpace + barHeight + BODGE_FACTOR, thickness, barHeight, radius);

	if (n == 0 || n == 2 || n == 3 ||  n == 5 || n == 6 || n == 8 || n == 9)
		dc.DrawRoundedRectangle(x + leftSpace + BODGE_FACTOR, y + topSpace + 2 * barHeight, barWidth, thickness, radius);
}
开发者ID:g4klx,项目名称:uWSDR,代码行数:49,代码来源:FreqDisplay.cpp

示例10: DrawHeaderButton

 virtual int DrawHeaderButton(wxWindow *WXUNUSED(win),
                               wxDC& dc,
                               const wxRect& rect,
                               int WXUNUSED(flags) = 0,
                               wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE,
                               wxHeaderButtonParams* WXUNUSED(params) = NULL)
 {
     dc.SetBrush(*wxBLUE_BRUSH);
     dc.SetTextForeground(*wxWHITE);
     dc.DrawRoundedRectangle(rect, 5);
     dc.DrawLabel(_T("MyRenderer"), wxNullBitmap, rect, wxALIGN_CENTER);
     return rect.width;
 }
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:13,代码来源:render.cpp

示例11: render

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

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

	std::ostringstream wop,wop2,wop3,wop4; 
	wop << std::fixed << std::setprecision(3) << (distance*factor);  
	
	double aux = 0.000;
	Position_x_Edit->GetValue().Trim().ToDouble(&aux);
	wop2 << std::fixed << std::setprecision (3) << aux;
	Position_y_Edit->GetValue().Trim().ToDouble(&aux);
	wop3 << std::fixed << std::setprecision (3) << aux;
	Position_z_Edit->GetValue().Trim().ToDouble(&aux);
	wop4 << std::fixed << std::setprecision (3) << aux;

	
	wxPoint box1_first(20-2,45-9);
	wxPoint box1_last(368,45+22);
	dc.DrawRoundedRectangle(box1_first.x, box1_first.y, box1_last.x-box1_first.x, box1_last.y-box1_first.y,3.1f);
	dc.DrawRotatedText(wxString(wop2.str().c_str(),wxConvUTF8),89+10-30-5,45, 0);
	dc.DrawRotatedText(wxString(wop3.str().c_str(),wxConvUTF8),89+10-30-5+92+10+15-3,45, 0);
	dc.DrawRotatedText(wxString(wop4.str().c_str(),wxConvUTF8),89+10-30-5+184+20+15+10-2,45, 0);

	wxFont font(10, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma"));
	wxFont font_ = dc.GetFont();
	dc.SetFont(font);
	dc.DrawRotatedText(_T("Distance:"),20,12, 0);
	dc.DrawRotatedText(wxString(wop.str().c_str(),wxConvUTF8),20+65,12, 0);
	dc.SetFont(font_);
}
开发者ID:BackupTheBerlios,项目名称:rvzware,代码行数:47,代码来源:UICalculateDistance.cpp

示例12: DrawHeaderButton

    virtual int DrawHeaderButton(wxWindow *WXUNUSED(win),
                                  wxDC& dc,
                                  const wxRect& rect,
                                  int WXUNUSED(flags) = 0,
                                  wxHeaderSortIconType WXUNUSED(sortArrow)
                                    = wxHDR_SORT_ICON_NONE,
                                  wxHeaderButtonParams* params = NULL)
    {
        wxDCBrushChanger setBrush(dc, *wxBLUE_BRUSH);
        wxDCTextColourChanger setFgCol(dc, *wxWHITE);
        dc.DrawRoundedRectangle(rect, 5);

        wxString label;
        if ( params )
            label = params->m_labelText;
        dc.DrawLabel(label, wxNullBitmap, rect, wxALIGN_CENTER);
        return rect.width;
    }
开发者ID:euler0,项目名称:Helium,代码行数:18,代码来源:render.cpp

示例13: 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

示例14: RenderText

void clRowEntry::RenderText(wxWindow* win, wxDC& dc, const clColours& colours, const wxString& text, int x, int y,
                            size_t col)
{
    if(IsHighlight()) {
        const clMatchResult& hi = GetHighlightInfo();
        Str3Arr_t arr;
        if(!hi.Get(col, arr)) {
            RenderTextSimple(win, dc, colours, text, x, y, col);
            return;
        }
#ifdef __WXMSW__
        const wxColour& defaultTextColour =
            m_tree->IsNativeTheme() ? colours.GetItemTextColour()
                                    : (IsSelected() ? colours.GetSelItemTextColour() : colours.GetItemTextColour());
#else
        const wxColour& defaultTextColour = IsSelected() ? colours.GetSelItemTextColour() : colours.GetItemTextColour();
#endif
        const wxColour& matchBgColour = colours.GetMatchedItemBgText();
        const wxColour& matchTextColour = colours.GetMatchedItemText();
        int xx = x;
        wxRect rowRect = GetItemRect();
        for(size_t i = 0; i < arr.size(); ++i) {
            wxString str = arr[i];
            bool is_match = (i == 1); // the middle entry is always the matched string
            wxSize sz = dc.GetTextExtent(str);
            rowRect.SetX(xx);
            rowRect.SetWidth(sz.GetWidth());
            if(is_match) {
                // draw a match rectangle
                dc.SetPen(matchBgColour);
                dc.SetBrush(matchBgColour);
                dc.SetTextForeground(matchTextColour);
                dc.DrawRoundedRectangle(rowRect, 3.0);
            } else {
                dc.SetTextForeground(defaultTextColour);
            }
            dc.DrawText(str, xx, y);
            xx += sz.GetWidth();
        }
    } else {
        // No match
        RenderTextSimple(win, dc, colours, text, x, y, col);
    }
}
开发者ID:eranif,项目名称:codelite,代码行数:44,代码来源:clRowEntry.cpp

示例15: Draw

void PhotoFrame::Draw(wxDC& dc, wxPoint& origin) {
	dc.SetBrush(BACKGROUND_BRUSH);
	dc.SetPen(BACKGROUND_PEN);
  dc.DrawRoundedRectangle(origin, SMALL_SIZE, CORNER_RADIUS);
  wxRect rect(
      origin.x + (SMALL_SIZE.x - SMALL_BITMAP_SIZE.x) / 2,
      origin.y + (SMALL_SIZE.y - SMALL_BITMAP_SIZE.y) / 2,
      SMALL_BITMAP_SIZE.x,
      SMALL_BITMAP_SIZE.y);
  if (!m_path.IsEmpty()) {
    wxBitmap* bitmap = m_cache.Get(m_path);
    if (bitmap != NULL) {
      rect.SetSize(wxSize(bitmap->GetWidth(), bitmap->GetHeight()));
      rect.x += (SMALL_BITMAP_SIZE.x - rect.width) / 2;
      rect.y += (SMALL_BITMAP_SIZE.y - rect.height) / 2;
      dc.DrawBitmap(*bitmap, rect.GetPosition());
    }
  }
  dc.SetBrush(*wxTRANSPARENT_BRUSH);
  dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
}
开发者ID:nagyist,项目名称:simple-photo,代码行数:21,代码来源:PhotoFrame.cpp


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