本文整理汇总了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
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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
}
示例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;
}}} */
}
示例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
}
示例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);
}