本文整理汇总了C++中wxDC::DrawArc方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::DrawArc方法的具体用法?C++ wxDC::DrawArc怎么用?C++ wxDC::DrawArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::DrawArc方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawOrigin
void PreviewWindow::DrawOrigin(wxDC& dc)
{
Point offset2 = offset;
wxSize size = GetSize();
offset2.x *= 1+wheelPosition/120*zoomFactor;
offset2.y *= 1+wheelPosition/120*zoomFactor;
offset2.x += size.GetWidth()/2;
offset2.y += size.GetHeight()/2;
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawArc(offset2.x, offset2.y+originSize, offset2.x+originSize, offset2.y, offset2.x, offset2.y);
dc.DrawArc(offset2.x, offset2.y-originSize, offset2.x-originSize, offset2.y, offset2.x, offset2.y);
dc.SetPen(*wxWHITE_PEN);
dc.SetBrush(*wxBLACK_BRUSH);
dc.DrawArc(offset2.x+originSize, offset2.y, offset2.x, offset2.y-originSize, offset2.x, offset2.y);
dc.DrawArc(offset2.x-originSize, offset2.y, offset2.x, offset2.y+originSize, offset2.x, offset2.y);
}
示例2: drawSymbol
void SeqPlot::drawSymbol ( char c , wxDC &dc , int x1 , int y1 , int x2 , int y2 )
{
dc.SetPen(*wxBLACK_PEN);
int w = x2 - x1 ;
int h = y2 - y1 ;
if ( c == 'T' )
{
x2--; w--; y1++; h--;
int y3 = y2 - h/4 ;
dc.DrawLine ( x1 , y1 , x2 - w/3 , y1 ) ;
dc.DrawLine ( x1 , y3 , x2 - w/3 , y3 ) ;
dc.DrawArc ( x2 - w/3 , y3 , x2 - w/3 , y1 , x2 - w/3 , (y1+y3)/2 ) ;
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine ( x2 - w/3 , y3-1 , x2 - w/3 , y1+1 ) ;
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine ( x1 , y3 , x1 + w*2/3 , y3 - h/2 ) ;
dc.DrawLine ( x1 , y3 , x1 + w*2/3 , y3 + h/2 ) ;
}
else if ( c == 'b' )
{
x1 += w/2 - h/6 ;
dc.DrawLine ( x1 , y1 , x1 , y2 ) ;
dc.DrawArc ( x1 , y1+h/3 , x1 , y1 , x1 , y1+h/6 ) ;
dc.DrawArc ( x1 , y1+h*2/3 , x1 , y1+h/3 , x1 , y1+h*3/6 ) ;
}
else if ( c == 'a' )
{
int x3 = x2 - w/3 ;
dc.DrawArc ( x3 , y1 + h/3 , x3 , y2 - h/3 , x1 + w/2 , y1 + h/2 ) ;
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine ( x3 , y1 + h/3 + 1 , x1 + w/2 , y1 + h/2 ) ;
dc.DrawLine ( x3 , y2 - h/3 - 1 , x1 + w/2 , y1 + h/2 ) ;
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine ( x3 , y1 + h/3 , x2 , y2 ) ;
dc.DrawLine ( x3 , y2 - h/3 , x2 , y1 ) ;
}
}
示例3: DrawCC_DrawCommandList
void DrawCC_DrawCommandList(wxDC& dc, const std::vector<CC_DrawCommand>& draw_commands)
{
for (auto iter = draw_commands.begin(); iter != draw_commands.end(); ++iter)
{
switch (iter->mType)
{
case CC_DrawCommand::Line:
dc.DrawLine(iter->x1, iter->y1, iter->x2, iter->y2);
break;
case CC_DrawCommand::Arc:
dc.DrawArc(iter->x1, iter->y1, iter->x2, iter->y2, iter->xc, iter->yc);
break;
case CC_DrawCommand::Ignore:
break;
}
}
}
示例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: Draw
void ChipPackage::Draw(wxDC& dc, const wxSize& sz, const wxString& chipModel)
{
// set some GUI objects common to all packages-drawing code
dc.SetPen(*wxBLACK_PEN);
switch (Type)
{
case PDIP:
case SOIC:
case SSOP:
{
// some drawing constants:
// in these package types, pins are organized in two columns:
const unsigned int PinPerSide = GetPinCount()/2;
if ((GetPinCount()%2) != 0)
{
wxLogWarning(_("Invalid odd pin count: %d"), GetPinCount());
return;
}
// choose reasonable package width&height to
// - make best use of the available space
// - avoid drawing package excessively big
const unsigned int BoxW = sz.GetWidth()/3;
const unsigned int BoxH = (unsigned int)((double)sz.GetHeight()*0.8);
const unsigned int BoxX = (sz.GetWidth()-BoxW)/2;
const unsigned int BoxY = (sz.GetHeight()-BoxH)/2;
const unsigned int R = BoxW/6;
if (int(BoxW/8) == 0)
return; // this happens for very small package sizes;
// the check avoids an assertion failure from wxFont ctor later
// draw the PIC package box
dc.DrawRectangle(BoxX, BoxY, BoxW, BoxH);
dc.DrawArc(sz.GetWidth()/2-R, BoxY + 1,
sz.GetWidth()/2+R, BoxY + 1,
sz.GetWidth()/2, BoxY + 1);
dc.SetFont(wxFont(wxSize(0, BoxW/8), wxFONTFAMILY_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
const wxSize& nameSz = dc.GetTextExtent(chipModel);
dc.DrawRotatedText(chipModel,
(sz.GetWidth() + nameSz.GetHeight())/2,
(sz.GetHeight() - nameSz.GetWidth())/2,
-90);
// draw the pins
DrawPins(dc, wxPoint(BoxX, BoxY), BoxH, 0, PinPerSide,
0, wxLEFT);
DrawPins(dc, wxPoint(BoxX+BoxW, BoxY), BoxH, PinPerSide, GetPinCount(),
DRAWPIN_INVERTED_ORDER, wxRIGHT);
}
break;
case MQFP:
case TQFP:
case PLCC:
case QFN:
{
// some drawing constants:
// in these package types, pins are organized in two columns:
const unsigned int PinPerSide = GetPinCount()/4;
if ((GetPinCount()%4) != 0)
{
wxLogWarning(_("Invalid pin count: %d"), GetPinCount());
return;
}
// choose reasonable package width&height to
// - make best use of the available space
// - avoid drawing package excessively big
const unsigned int BoxL = max(sz.GetWidth()/2,80);
const unsigned int BoxX = (sz.GetWidth()-BoxL)/2;
const unsigned int BoxY = (sz.GetHeight()-BoxL)/2;
const unsigned int R = BoxL/10;
if (int(BoxL/10) == 0)
return; // this happens for very small package sizes;
// the check avoids an assertion failure from wxFont ctor later
// draw the PIC package box
dc.DrawRectangle(BoxX, BoxY, BoxL, BoxL);
dc.DrawCircle(BoxX+int(R*1.3), BoxY+int(R*1.3), R/2);
// draw the name of the PIC model in the centre of the box
dc.SetFont(wxFont(wxSize(0, BoxL/10), wxFONTFAMILY_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
const wxSize& nameSz = dc.GetTextExtent(chipModel);
dc.DrawText(chipModel,
(sz.GetWidth() - nameSz.GetWidth())/2,
(sz.GetHeight() - nameSz.GetHeight())/2);
// draw the pins
DrawPins(dc, wxPoint(BoxX, BoxY), BoxL, 0, PinPerSide,
DRAWPIN_NUMBERS_INSIDE_PINS, wxLEFT);
DrawPins(dc, wxPoint(BoxX, BoxY+BoxL), BoxL, PinPerSide, PinPerSide*2,
//.........这里部分代码省略.........
示例6: OnDraw
// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
// vars to use ...
#if wxUSE_STATUSBAR
wxString s;
#endif // wxUSE_STATUSBAR
wxPen wP;
wxBrush wB;
wxPoint points[6];
wxColour wC;
wxFont wF;
dc.SetFont(*wxSWISS_FONT);
dc.SetPen(*wxGREEN_PEN);
switch (m_index)
{
default:
case 0:
// draw lines to make a cross
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
// draw point colored line and spline
wP = *wxCYAN_PEN;
wP.SetWidth(3);
dc.SetPen(wP);
dc.DrawPoint (25,15);
dc.DrawLine(50, 30, 200, 30);
dc.DrawSpline(50, 200, 50, 100, 200, 10);
#if wxUSE_STATUSBAR
s = wxT("Green Cross, Cyan Line and spline");
#endif // wxUSE_STATUSBAR
break;
case 1:
// draw standard shapes
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRectangle(10, 10, 100, 70);
wB = wxBrush (wxT("DARK ORCHID"), wxBRUSHSTYLE_TRANSPARENT);
dc.SetBrush (wB);
dc.DrawRoundedRectangle(50, 50, 100, 70, 20);
dc.SetBrush (wxBrush(wxT("GOLDENROD")) );
dc.DrawEllipse(100, 100, 100, 50);
points[0].x = 100; points[0].y = 200;
points[1].x = 70; points[1].y = 260;
points[2].x = 160; points[2].y = 230;
points[3].x = 40; points[3].y = 230;
points[4].x = 130; points[4].y = 260;
points[5].x = 100; points[5].y = 200;
dc.DrawPolygon(5, points);
dc.DrawLines (6, points, 160);
#if wxUSE_STATUSBAR
s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars");
#endif // wxUSE_STATUSBAR
break;
case 2:
// draw text in Arial or similar font
dc.DrawLine(50,25,50,35);
dc.DrawLine(45,30,55,30);
dc.DrawText(wxT("This is a Swiss-style string"), 50, 30);
wC = dc.GetTextForeground();
dc.SetTextForeground (wxT("FIREBRICK"));
// 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);
//.........这里部分代码省略.........
示例7: DrawPath
void PreviewWindow::DrawPath(wxDC& dc)
{
wxColour cw = cCWColour;
wxColour ccw = cCCWColour;
for_each(toDraw.begin(), toDraw.end(), [&](PathPartSimple p)
{
switch(p.type)
{
case LINE_NORMAL:
{
dc.SetPen(wxPen(normalColour, lineWidth, wxSOLID));
p.start = TransformPoint(p.start);
p.end = TransformPoint(p.end);
dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y);
}
break;
case LINE_RAPID:
{
dc.SetPen(wxPen(rapidColour, lineWidth, wxLONG_DASH));
p.start = TransformPoint(p.start);
p.end = TransformPoint(p.end);
dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y);
}
break;
case CIRCLE_CW:
{
cw.Set(255-cw.Red(), cw.Green(), cw.Blue());//Differes two circles
dc.SetPen(wxPen(cw, lineWidth, wxSOLID));
p.start = TransformPoint(p.start);
p.end = TransformPoint(p.end);
p.center = TransformPoint(p.center);
dc.SetBrush(wxBrush(wxColour(), wxTRANSPARENT));
Vector2D distance(p.start, p.end);
if(distance.Length() < 2)
break;
distance = Vector2D(p.center, p.start);
if(distance.Length() < 2)
break;
dc.DrawArc(p.start.x, p.start.y, p.end.x, p.end.y, p.center.x, p.center.y);
}
break;
case CIRCLE_CCW:
{
ccw.Set(255-ccw.Red(), ccw.Green(), ccw.Blue());//Differes two circles
dc.SetPen(wxPen(ccw, lineWidth, wxSOLID));
p.start = TransformPoint(p.start);
p.end = TransformPoint(p.end);
p.center = TransformPoint(p.center);
dc.SetBrush(wxBrush(wxColour(), wxTRANSPARENT));
Vector2D distance(p.start, p.end);
if(distance.Length() < 2)
break;
distance = Vector2D(p.center, p.start);
if(distance.Length() < 2)
break;
dc.DrawArc(p.end.x, p.end.y, p.start.x, p.start.y, p.center.x, p.center.y);
}
break;
}
});
for_each(offsetToDraw.begin(), offsetToDraw.end(), [&](PathPartSimple p)
{
dc.SetPen(wxPen(wxColor(255, 255, 255), lineWidth, wxSOLID));
switch(p.type)
{
case LINE_NORMAL:
{
p.start = TransformPoint(p.start);
p.end = TransformPoint(p.end);
dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y);
}
break;
case LINE_RAPID:
{
dc.SetPen(wxPen(wxColor(255, 255, 255), lineWidth, wxDOT_DASH));
p.start = TransformPoint(p.start);
p.end = TransformPoint(p.end);
dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y);
}
break;
case CIRCLE_CW:
case OFFSET_CIRCLE_CW:
{
static wxColour c = cCWColour;
c.Set(255-c.Red(), c.Green(), c.Blue());
p.start = TransformPoint(p.start);
p.end = TransformPoint(p.end);
p.center = TransformPoint(p.center);
dc.SetBrush(wxBrush(wxColour(), wxTRANSPARENT));
Vector2D distance(p.start, p.end);
if(distance.Length() < 2)
break;
distance = Vector2D(p.center, p.start);
if(distance.Length() < 2)
break;
dc.DrawArc(p.start.x, p.start.y, p.end.x, p.end.y, p.center.x, p.center.y);
}
break;
//.........这里部分代码省略.........
示例8: 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);
}
}
示例9: OnDraw
// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
// vars to use ...
#if wxUSE_STATUSBAR
wxString s ;
#endif // wxUSE_STATUSBAR
wxPen wP ;
wxBrush wB ;
wxPoint points[6];
wxColour wC;
wxFont wF ;
dc.SetFont(*wxSWISS_FONT);
dc.SetPen(*wxGREEN_PEN);
switch (m_index)
{
default:
case 0:
// draw lines to make a cross
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
// draw point colored line and spline
wP = *wxCYAN_PEN ;
wP.SetWidth(3);
dc.SetPen(wP);
dc.DrawPoint (25,15) ;
dc.DrawLine(50, 30, 200, 30);
dc.DrawSpline(50, 200, 50, 100, 200, 10);
#if wxUSE_STATUSBAR
s = wxT("Green Cross, Cyan Line and spline");
#endif // wxUSE_STATUSBAR
break ;
case 1:
// draw standard shapes
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRectangle(10, 10, 100, 70);
wB = wxBrush (_T("DARK ORCHID"), wxTRANSPARENT);
dc.SetBrush (wB);
dc.DrawRoundedRectangle(50, 50, 100, 70, 20);
dc.SetBrush (wxBrush(_T("GOLDENROD"), wxSOLID) );
dc.DrawEllipse(100, 100, 100, 50);
points[0].x = 100; points[0].y = 200;
points[1].x = 70; points[1].y = 260;
points[2].x = 160; points[2].y = 230;
points[3].x = 40; points[3].y = 230;
points[4].x = 130; points[4].y = 260;
points[5].x = 100; points[5].y = 200;
dc.DrawPolygon(5, points);
dc.DrawLines (6, points, 160);
#if wxUSE_STATUSBAR
s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars");
#endif // wxUSE_STATUSBAR
break ;
case 2:
// draw text in Arial or similar font
dc.DrawLine(50,25,50,35);
dc.DrawLine(45,30,55,30);
dc.DrawText(wxT("This is a Swiss-style string"), 50, 30);
wC = dc.GetTextForeground() ;
dc.SetTextForeground (_T("FIREBRICK"));
// 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);
//.........这里部分代码省略.........
示例10: drawUserInterface
//.........这里部分代码省略.........
// draw coordinate system
if (_style & DRAW_LOCAL_COORDINATE_SYSTEM)
{
dc.SetPen(greenPen);
}
else
{
dc.SetPen(whitePen);
}
dc.DrawLine(pos.x + 2, pos.y + 3, pos.x + 2, pos.y + _buttonSize - 2);
dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, size.x - 3, pos.y + _buttonSize - 2);
dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 6, pos.y + _buttonSizeHalf + 2);
pos.y += _buttonSize;
// draw joint constraints
if (_style & DRAW_JOINT_CONSTRAINTS)
{
dc.SetPen(greenPen);
}
else
{
dc.SetPen(whitePen);
}
//dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 3);
//dc.DrawArc(pos.x + 4, pos.y + 5, pos.x + 4, pos.y + _buttonSize - 5, pos.x + _buttonSizeHalf + 2, pos.y + _buttonSizeHalf);
//dc.DrawCircle(pos.x + 6, pos.y + _buttonSizeHalf, 3);
dc.DrawEllipse(pos.x + 4, pos.y + 3, _buttonSizeHalf - 5, _buttonSizeHalf + 4);
dc.DrawLine(pos.x + 8, pos.y + 3, pos.x + _buttonSizeHalf + 5, pos.y + _buttonSizeHalf);
dc.DrawLine(pos.x + 8, pos.y + _buttonSizeHalf + 7, pos.x + _buttonSizeHalf + 5, pos.y + _buttonSizeHalf);
pos.y += _buttonSize;
// draw rotation axis
if (_style & DRAW_ROTATION_AXIS)
{
dc.SetPen(greenPen);
}
else
{
dc.SetPen(whitePen);
}
dc.DrawArc(pos.x + _buttonSizeHalf + 2, pos.y + _buttonSize - 2, pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf + 1, pos.x + 2, pos.y + _buttonSize - 2);
//dc.DrawEllipse(pos.x + 6, pos.y + 5, _buttonSize - 12, _buttonSize - 10);
//dc.DrawCircle(pos.x + _buttonSizeHalf + 2, pos.y + _buttonSizeHalf - 2, 3);
dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 2, pos.y + 2);
dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 2, pos.y + _buttonSize - 2);
pos.y += _buttonSize;
// draw label
if (_style & DRAW_LABEL)
{
dc.SetPen(greenPen);
}
else
{
dc.SetPen(whitePen);
}
dc.DrawRoundedRectangle(pos.x + 4, pos.y + 3, _buttonSize - 5, _buttonSizeHalf, 3.0);
dc.DrawSpline(pos.x + 4, pos.y + _buttonSizeHalf - 3, pos.x + 1, pos.y + _buttonSizeHalf + 4, pos.x + _buttonSizeHalf + 4, pos.y + _buttonSizeHalf + 6);
pos.y += _buttonSize;
// draw locate skeleton button
dc.SetPen(whitePen);
dc.DrawLine(pos.x + _buttonSizeHalf, pos.y + 2, pos.x + _buttonSizeHalf, pos.y + _buttonSize - 1);
dc.DrawLine(pos.x + 2, pos.y + _buttonSizeHalf, size.x - 1, pos.y + _buttonSizeHalf);
dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 4);
brush.SetColour(wxColour(255, 255, 255));
dc.SetBrush(brush);
dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 8);
pos.y += _buttonSize;
// draw settings button
dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 3);
dc.SetPen(blackPen);
brush.SetColour(wxColour(0, 0, 0));
dc.SetBrush(brush);
dc.DrawCircle(pos.x + _buttonSizeHalf + 6, pos.y + _buttonSizeHalf, 2);
dc.DrawCircle(pos.x + _buttonSizeHalf - 6, pos.y + _buttonSizeHalf, 2);
dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf + 6, 2);
dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf - 6, 2);
dc.SetPen(whitePen);
dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 7);
}
示例11: DrawCrossings
void wxLineCrossings::DrawCrossings(wxDiagram& WXUNUSED(diagram), wxDC& dc)
{
dc.SetBrush(*wxTRANSPARENT_BRUSH);
long arcWidth = 8;
wxNode* node = m_crossings.GetFirst();
while (node)
{
wxLineCrossing* crossing = (wxLineCrossing*) node->GetData();
// dc.DrawEllipse((long) (crossing->m_intersect.x - (arcWidth/2.0) + 0.5), (long) (crossing->m_intersect.y - (arcWidth/2.0) + 0.5),
// arcWidth, arcWidth);
// Let's do some geometry to find the points on either end of the arc.
/*
(x1, y1)
|\
| \
| \
| \
| \
| |\ c c1
| a | \
| \
| - x <-- centre of arc
a1 | b |\
| | \ c2
| a2 | \
| - \
| b2 \
| \
|_______________\ (x2, y2)
b1
*/
double a1 = wxMax(crossing->m_pt1.y, crossing->m_pt2.y) - wxMin(crossing->m_pt1.y, crossing->m_pt2.y) ;
double b1 = wxMax(crossing->m_pt1.x, crossing->m_pt2.x) - wxMin(crossing->m_pt1.x, crossing->m_pt2.x) ;
double c1 = sqrt( (a1*a1) + (b1*b1) );
double c = arcWidth / 2.0;
double a = c * a1/c1 ;
double b = c * b1/c1 ;
// I'm not sure this is right, since we don't know which direction we should be going in - need
// to know which way the line slopes and choose the sign appropriately.
double arcX1 = crossing->m_intersect.x - b;
double arcY1 = crossing->m_intersect.y - a;
double arcX2 = crossing->m_intersect.x + b;
double arcY2 = crossing->m_intersect.y + a;
dc.SetPen(*wxBLACK_PEN);
dc.DrawArc( (long) arcX1, (long) arcY1, (long) arcX2, (long) arcY2,
(long) crossing->m_intersect.x, (long) crossing->m_intersect.y);
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine( (long) arcX1, (long) arcY1, (long) arcX2, (long) arcY2 );
node = node->GetNext();
}
}