本文整理汇总了C++中wxDC::DrawEllipticArc方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::DrawEllipticArc方法的具体用法?C++ wxDC::DrawEllipticArc怎么用?C++ wxDC::DrawEllipticArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::DrawEllipticArc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawSectors
void kwxAngularMeter::DrawSectors(wxDC &dc)
{
double starc,endarc;
int secount,dx,dy;
int w,h ;
double val;
GetClientSize(&w,&h);
wxRect innerRect;
innerRect.x = w*2/35;
innerRect.y = h*2/35;
innerRect.width = w-2*innerRect.x;
innerRect.height = h-2*innerRect.y;
//Arch -> sectors
//dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxSOLID));
dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxTRANSPARENT));
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.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxTRANSPARENT));
dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_aSectorColor[secount],wxSOLID));
dc.DrawEllipticArc(0,0,w,h,180 - endarc,180 - starc);
dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_cBackColour,wxSOLID));
dc.DrawEllipticArc(innerRect.x,innerRect.y,innerRect.width,innerRect.height,180 - endarc,180 - starc);
starc = endarc;
endarc += ((m_nAngleEnd - m_nAngleStart) / (double)m_nSec);
}
val = (m_nAngleStart * m_dPI) / 180.0;
dx = cos(val) * h / 2.0;
dy = sin(val) * h / 2.0;
dc.DrawLine(w / 2, h / 2, (w / 2) - dx, (h / 2) - dy); //left line
val = (m_nAngleEnd * m_dPI) / 180.0;
dx = cos(val) * h / 2.0;
dy = sin(val) * h / 2.0;
dc.DrawLine(w / 2, h / 2, (w / 2) - dx, (h / 2) - dy); //right line
}
示例2: DrawSectors
void AngularMeter::DrawSectors(wxDC &dc)
{
int w,h ;
GetClientSize(&w,&h);
int hOffset = 0;
int wOffset = 0;
if (w > h) wOffset = (w - h) / 2;
if (h > w) hOffset = (h - w) / 2;
//square out the size
if (w > h) w=h;
if (h > w) h=w;
//Draw the dial
dc.SetPen(*wxThePenList->FindOrCreatePen(_dialColor,1 , wxSOLID));
dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(_dialColor,wxSOLID));
dc.DrawEllipticArc(0 + wOffset, 0 + hOffset, w, h, 0, 360);
dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*wxBLACK, wxTRANSPARENT));
dc.SetPen(*wxThePenList->FindOrCreatePen(wxColor(0x25,0x25,0x25), 2, wxSOLID));
dc.DrawEllipticArc(0 + wOffset, 0 + hOffset, w, h, 45, -135);
dc.SetPen(*wxThePenList->FindOrCreatePen(wxColor(0x55,0x55,0x55), 2, wxSOLID));
dc.DrawEllipticArc(0 + wOffset, 0 + hOffset, w, h, -135, 45);
//Done drawing dial
//Draw warning range
if (_realWarningValue > 0){
dc.SetPen(*wxThePenList->FindOrCreatePen(_warningColor,2, wxSOLID));
dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(_warningColor, wxFDIAGONAL_HATCH));
double warningEnd = _angleEnd - _scaledWarningValue;
double warningStart = (_realAlertValue > 0 ? _angleEnd - _scaledAlertValue : _angleStart);
dc.DrawEllipticArc(0 + wOffset + 1, 0 + hOffset + 1, w - 2, h - 2, warningStart, warningEnd);
}
if (_realAlertValue > 0){
dc.SetPen(*wxThePenList->FindOrCreatePen(_alertColor, 3, wxSOLID));
dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(_alertColor, wxBDIAGONAL_HATCH));
dc.DrawEllipticArc(0 + wOffset + 1, 0 + hOffset + 1, w - 2, h - 2, _angleStart, _angleEnd - _scaledAlertValue);
}
}
示例3: 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
}
示例4: Draw
void MyApp::Draw(wxDC&dc)
{
// This routine just draws a bunch of random stuff on the screen so that we
// can check that different types of object are being drawn consistently
// between the screen image, the print preview image (at various zoom
// levels), and the printed page.
dc.SetBackground(*wxWHITE_BRUSH);
// dc.Clear();
dc.SetFont(m_testFont);
// dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
dc.DrawRectangle(0, 0, 230, 350);
dc.DrawLine(0, 0, 229, 349);
dc.DrawLine(229, 0, 0, 349);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRoundedRectangle(0, 20, 200, 80, 20);
dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40);
dc.SetPen( wxPen(*wxBLACK, 0, wxPENSTYLE_DOT_DASH) );
dc.DrawEllipse(50, 140, 100, 50);
dc.SetPen(*wxRED_PEN);
dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180);
#if wxUSE_UNICODE
const char *test = "Hebrew שלום -- Japanese (日本語)";
wxString tmp = wxConvUTF8.cMB2WC( test );
dc.DrawText( tmp, 10, 200 );
#endif
wxPoint points[5];
points[0].x = 0;
points[0].y = 0;
points[1].x = 20;
points[1].y = 0;
points[2].x = 20;
points[2].y = 20;
points[3].x = 10;
points[3].y = 20;
points[4].x = 10;
points[4].y = -20;
dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE );
dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE );
dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 );
points[0].x = 150;
points[0].y = 250;
points[1].x = 180;
points[1].y = 250;
points[2].x = 180;
points[2].y = 220;
points[3].x = 200;
points[3].y = 220;
dc.DrawSpline( 4, points );
dc.DrawArc( 20,10, 10,10, 25,40 );
wxString str;
int i = 0;
str.Printf( wxT("---- Text at angle %d ----"), i );
dc.DrawRotatedText( str, 100, 300, i );
i = m_angle;
str.Printf( wxT("---- Text at angle %d ----"), i );
dc.DrawRotatedText( str, 100, 300, i );
wxIcon my_icon = wxICON(sample);
dc.DrawIcon( my_icon, 100, 100);
if (m_bitmap.IsOk())
dc.DrawBitmap( m_bitmap, 10, 10 );
#if wxUSE_GRAPHICS_CONTEXT
wxGraphicsContext *gc = NULL;
wxPrinterDC *printer_dc = wxDynamicCast( &dc, wxPrinterDC );
if (printer_dc)
gc = wxGraphicsContext::Create( *printer_dc );
wxWindowDC *window_dc = wxDynamicCast( &dc, wxWindowDC );
if (window_dc)
gc = wxGraphicsContext::Create( *window_dc );
#ifdef __WXMSW__
wxEnhMetaFileDC *emf_dc = wxDynamicCast( &dc, wxEnhMetaFileDC );
if (emf_dc)
gc = wxGraphicsContext::Create( *emf_dc );
#endif
//.........这里部分代码省略.........
示例5: OnDraw
//.........这里部分代码省略.........
// no effect in msw ??
dc.SetTextBackground (wxT("WHEAT"));
dc.DrawText(wxT("This is a Red string"), 50, 200);
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.SetTextForeground (wC);
dc.DrawText(wxT("This is a Times-style string"), 50, 60);
#if wxUSE_STATUSBAR
s = wxT("Swiss, Times text; red text, rotated and colored orange");
#endif // wxUSE_STATUSBAR
break;
case 3 :
// four arcs start and end points, center
dc.SetBrush(*wxGREEN_BRUSH);
dc.DrawArc ( 200,300, 370,230, 300,300 );
dc.SetBrush(*wxBLUE_BRUSH);
dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
dc.SetDeviceOrigin(-10,-10);
dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
dc.SetDeviceOrigin(0,0);
wP.SetColour (wxT("CADET BLUE"));
dc.SetPen(wP);
dc.DrawArc ( 75,125, 110, 40, 75, 75 );
wP.SetColour (wxT("SALMON"));
dc.SetPen(wP);
dc.SetBrush(*wxRED_BRUSH);
//top left corner, width and height, start and end angle
// 315 same center and x-radius as last pie-arc, half Y radius
dc.DrawEllipticArc(25,50,100,50,180.0,45.0);
wP = *wxCYAN_PEN;
wP.SetWidth(3);
dc.SetPen(wP);
//wxTRANSPARENT));
dc.SetBrush (wxBrush (wxT("SALMON")));
dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0);
//same end point
dc.DrawEllipticArc(300, 50,200,100,90.0,145.0);
dc.DrawEllipticArc(300,100,200,100,90.0,345.0);
#if wxUSE_STATUSBAR
s = wxT("This is an arc test page");
#endif // wxUSE_STATUSBAR
break;
case 4:
dc.DrawCheckMark ( 30,30,25,25);
dc.SetBrush (wxBrush (wxT("SALMON"),wxBRUSHSTYLE_TRANSPARENT));
dc.DrawCheckMark ( 80,50,75,75);
dc.DrawRectangle ( 80,50,75,75);
#if wxUSE_STATUSBAR
s = wxT("Two check marks");
#endif // wxUSE_STATUSBAR
break;
case 5:
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string"), 50, 60);
示例6: Draw
void MyFrame::Draw(wxDC& dc)
{
// This routine just draws a bunch of random stuff on the screen so that we
// can check that different types of object are being drawn consistently
// between the screen image, the print preview image (at various zoom
// levels), and the printed page.
dc.SetBackground(*wxWHITE_BRUSH);
dc.Clear();
dc.SetFont(wxGetApp().m_testFont);
dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
// dc.SetBackground(*wxWHITE_BRUSH);
dc.DrawRectangle(0, 0, 230, 350);
dc.DrawLine(0, 0, 229, 349);
dc.DrawLine(229, 0, 0, 349);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRoundedRectangle(0, 20, 200, 80, 20);
dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40);
dc.SetPen( wxPen(*wxBLACK,0,wxDOT_DASH) );
dc.DrawEllipse(50, 140, 100, 50);
dc.SetPen(*wxRED_PEN);
dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180);
#if wxUSE_UNICODE
//char *test = "Hebrew שלום -- Japanese (日本語)";
//wxString tmp = wxConvUTF8.cMB2WC( test );
//dc.DrawText( tmp, 10, 200 );
#endif
wxPoint points[5];
points[0].x = 0;
points[0].y = 0;
points[1].x = 20;
points[1].y = 0;
points[2].x = 20;
points[2].y = 20;
points[3].x = 10;
points[3].y = 20;
points[4].x = 10;
points[4].y = -20;
dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE );
dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE );
dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 );
points[0].x = 150;
points[0].y = 250;
points[1].x = 180;
points[1].y = 250;
points[2].x = 180;
points[2].y = 220;
points[3].x = 200;
points[3].y = 220;
dc.DrawSpline( 4, points );
dc.DrawArc( 20,10, 10,10, 25,40 );
wxString str;
int i = 0;
str.Printf( wxT("---- Text at angle %d ----"), i );
dc.DrawRotatedText( str, 100, 300, i );
i = m_angle;
str.Printf( wxT("---- Text at angle %d ----"), i );
dc.DrawRotatedText( str, 100, 300, i );
wxIcon my_icon = wxICON(mondrian) ;
dc.DrawIcon( my_icon, 100, 100);
if (m_bitmap.Ok())
{
dc.DrawBitmap(m_bitmap, 10, 25);
}
if (m_imgUp.Ok())
{
dc.DrawBitmap(m_imgUp, 300, 200);
dc.DrawBitmap(m_imgUp, 300, 250, true);
}
}
示例7: OnDraw
//.........这里部分代码省略.........
// no effect in msw ??
dc.SetTextBackground (_T("WHEAT"));
dc.DrawText(wxT("This is a Red string"), 50, 200);
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.SetTextForeground (wC) ;
dc.DrawText(wxT("This is a Times-style string"), 50, 60);
#if wxUSE_STATUSBAR
s = wxT("Swiss, Times text; red text, rotated and colored orange");
#endif // wxUSE_STATUSBAR
break ;
case 3 :
// four arcs start and end points, center
dc.SetBrush(*wxGREEN_BRUSH);
dc.DrawArc ( 200,300, 370,230, 300,300 );
dc.SetBrush(*wxBLUE_BRUSH);
dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
dc.SetDeviceOrigin(-10,-10);
dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
dc.SetDeviceOrigin(0,0);
wP.SetColour (_T("CADET BLUE"));
dc.SetPen(wP);
dc.DrawArc ( 75,125, 110, 40, 75, 75 );
wP.SetColour (_T("SALMON"));
dc.SetPen(wP);
dc.SetBrush(*wxRED_BRUSH);
//top left corner, width and height, start and end angle
// 315 same center and x-radius as last pie-arc, half Y radius
dc.DrawEllipticArc(25,50,100,50,180.0,45.0) ;
wP = *wxCYAN_PEN ;
wP.SetWidth(3);
dc.SetPen(wP);
//wxTRANSPARENT));
dc.SetBrush (wxBrush (_T("SALMON"),wxSOLID)) ;
dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0) ;
//same end point
dc.DrawEllipticArc(300, 50,200,100,90.0,145.0) ;
dc.DrawEllipticArc(300,100,200,100,90.0,345.0) ;
#if wxUSE_STATUSBAR
s = wxT("This is an arc test page");
#endif // wxUSE_STATUSBAR
break ;
case 4:
dc.DrawCheckMark ( 30,30,25,25);
dc.SetBrush (wxBrush (_T("SALMON"),wxTRANSPARENT));
dc.DrawCheckMark ( 80,50,75,75);
dc.DrawRectangle ( 80,50,75,75);
#if wxUSE_STATUSBAR
s = wxT("Two check marks");
#endif // wxUSE_STATUSBAR
break ;
case 5:
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string"), 50, 60);