本文整理汇总了C++中wxDC::DrawCheckMark方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::DrawCheckMark方法的具体用法?C++ wxDC::DrawCheckMark怎么用?C++ wxDC::DrawCheckMark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::DrawCheckMark方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void wxSheetCellBoolRendererRefData::Draw(wxSheet& sheet,
const wxSheetCellAttr& attr,
wxDC& dc, const wxRect& rect,
const wxSheetCoords& coords,
bool isSelected)
{
wxSheetCellRendererRefData::Draw(sheet, attr, dc, rect, coords, isSelected);
// draw a check mark in the centre (ignoring alignment - TODO)
wxSize size = GetBestSize(sheet, attr, dc, coords);
// don't draw outside the cell
wxCoord minSize = wxMin(rect.width, rect.height) - 1;
if ((size.x >= minSize) || (size.y >= minSize))
size.x = size.y = minSize - 2; // leave (at least) 1 pixel margin
// draw a border around checkmark
int align = attr.GetAlignment();
wxRect rectBorder(rect.GetPosition(), size);
if ((align & wxALIGN_RIGHT) != 0)
rectBorder.x += rect.width - size.x - 2;
else if ((align & wxALIGN_CENTRE_HORIZONTAL) != 0)
rectBorder.x += rect.width/2 - size.x/2;
else // wxALIGN_LEFT
rectBorder.x += 2;
if ((align & wxALIGN_BOTTOM) != 0)
rectBorder.y += rect.height - size.y - 2;
else if ((align & wxALIGN_CENTRE_VERTICAL) != 0)
rectBorder.y += rect.height/2 - size.y/2;
else // wxALIGN_TOP
rectBorder.y += 2;
bool value = false;
if ( sheet.GetTable() && sheet.GetTable()->CanGetValueAs(coords, wxSHEET_VALUE_BOOL) )
value = sheet.GetTable()->GetValueAsBool(coords);
else
{
wxString strValue( sheet.GetCellValue(coords) );
value = !( strValue.IsEmpty() || (strValue == wxT("0")) ||
(strValue.Lower() == wxT("f")) || (strValue.Lower() == wxT("false")));
}
if ( value )
{
wxRect rectMark = rectBorder;
#ifdef __WXMSW__
// MSW DrawCheckMark() is weird (and should probably be changed...)
rectMark.Inflate(-wxSHEET_CHECKMARK_MARGIN/2);
rectMark.x++;
rectMark.y++;
#else // !MSW
rectMark.Inflate(-wxSHEET_CHECKMARK_MARGIN);
#endif // MSW/!MSW
dc.SetTextForeground(attr.GetForegroundColour());
dc.DrawCheckMark(rectMark);
}
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(wxPen(attr.GetForegroundColour(), 1, wxSOLID));
dc.DrawRectangle(rectBorder);
}
示例2: OnDraw
//.........这里部分代码省略.........
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);
// rescale and draw in blue
wP = *wxCYAN_PEN;
dc.SetPen(wP);
dc.SetUserScale (2.0,0.5);
dc.SetDeviceOrigin(200,0);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string 2 x 0.5 UserScaled"), 50, 60);
dc.SetUserScale (2.0,2.0);
dc.SetDeviceOrigin(200,200);
dc.DrawText(wxT("This is an 18pt string 2 x 2 UserScaled"), 50, 60);
wP = *wxRED_PEN;
dc.SetPen(wP);
dc.SetUserScale (1.0,1.0);
dc.SetDeviceOrigin(0,10);
dc.SetMapMode (wxMM_METRIC); //svg ignores this
示例3: OnDraw
//.........这里部分代码省略.........
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);
// rescale and draw in blue
wP = *wxCYAN_PEN ;
dc.SetPen(wP);
dc.SetUserScale (2.0,0.5);
dc.SetDeviceOrigin(200,0);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string 2 x 0.5 UserScaled"), 50, 60);
dc.SetUserScale (2.0,2.0);
dc.SetDeviceOrigin(200,200);
dc.DrawText(wxT("This is an 18pt string 2 x 2 UserScaled"), 50, 60);
wP = *wxRED_PEN ;
dc.SetPen(wP);
dc.SetUserScale (1.0,1.0);
dc.SetDeviceOrigin(0,10);
dc.SetMapMode (wxMM_METRIC) ; //svg ignores this
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string in MapMode"), 50, 60);
#if wxUSE_STATUSBAR
s = wxT("Scaling test page");
#endif // wxUSE_STATUSBAR
break ;
case 6:
dc.DrawIcon( wxIcon(mondrian_xpm), 10, 10 );
dc.DrawBitmap ( wxBitmap(svgbitmap_xpm), 50,15);
#if wxUSE_STATUSBAR
s = wxT("Icon and Bitmap ");
#endif // wxUSE_STATUSBAR
break ;
}
#if wxUSE_STATUSBAR
m_child->SetStatusText(s);
#endif // wxUSE_STATUSBAR
}