本文整理汇总了C++中wxDC::SetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::SetFont方法的具体用法?C++ wxDC::SetFont怎么用?C++ wxDC::SetFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::SetFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void TimeRenderer::Draw(wxGrid &grid,
wxGridCellAttr &attr,
wxDC &dc,
const wxRect &rect,
int row,
int col,
bool isSelected)
{
wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
wxGridTableBase *table = grid.GetTable();
TimeEditor *te = (TimeEditor *) grid.GetCellEditor(row, col);
wxString tstr;
if (te) {
double value;
table->GetValue(row, col).ToDouble(&value);
NumericTextCtrl tt(NumericConverter::TIME, &grid,
wxID_ANY,
te->GetFormat(),
value,
te->GetRate(),
wxPoint(10000, 10000), // create offscreen
wxDefaultSize,
true);
tstr = tt.GetString();
te->DecRef();
}
dc.SetBackgroundMode(wxTRANSPARENT);
if (grid.IsEnabled())
{
if (isSelected)
{
dc.SetTextBackground(grid.GetSelectionBackground());
dc.SetTextForeground(grid.GetSelectionForeground());
}
else
{
dc.SetTextBackground(attr.GetBackgroundColour());
dc.SetTextForeground(attr.GetTextColour());
}
}
else
{
dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
}
dc.SetFont(attr.GetFont());
int hAlign, vAlign;
attr.GetAlignment(&hAlign, &vAlign);
grid.DrawTextRectangle(dc, tstr, rect, hAlign, vAlign);
}
示例2: DrawPanelBackground
void wxRibbonMetroArtProvider::DrawPanelBackground(
wxDC& dc,
wxRibbonPanel* wnd,
const wxRect& rect)
{
DrawPartialPageBackground(dc, wnd, rect, false);
wxRect true_rect(rect);
RemovePanelPadding(&true_rect);
bool has_ext_button = wnd->HasExtButton();
// draw panel label
{
// int label_height;
dc.SetFont(m_panel_label_font);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetTextForeground(m_panel_label_colour);
wxRect label_rect(true_rect);
wxString label = wnd->GetLabel();
bool clip_label = false;
wxSize label_size(dc.GetTextExtent(label));
label_rect.SetX(label_rect.GetX() + 1);
label_rect.SetWidth(label_rect.GetWidth() - 2);
label_rect.SetHeight(label_size.GetHeight() + 2);
label_rect.SetY(true_rect.GetBottom() - label_rect.GetHeight());
// label_height = label_rect.GetHeight();
wxRect label_bg_rect = label_rect;
if(has_ext_button)
label_rect.SetWidth(label_rect.GetWidth() - 13);
if(label_size.GetWidth() > label_rect.GetWidth())
{
// Test if there is enough length for 3 letters and ...
wxString new_label = label.Mid(0, 3) + wxT("...");
label_size = dc.GetTextExtent(new_label);
if(label_size.GetWidth() > label_rect.GetWidth())
{
// Not enough room for three characters and ...
// Display the entire label and just crop it
clip_label = true;
}
else
{
// Room for some characters and ...
// Display as many characters as possible and append ...
for(size_t len = label.Len() - 1; len >= 3; --len)
{
new_label = label.Mid(0, len) + wxT("...");
label_size = dc.GetTextExtent(new_label);
if(label_size.GetWidth() <= label_rect.GetWidth())
{
label = new_label;
break;
}
}
}
}
dc.DrawRectangle(label_bg_rect);
if(clip_label)
{
wxDCClipper clip(dc, label_rect);
dc.DrawText(label, label_rect.x, label_rect.y +
(label_rect.GetHeight() - label_size.GetHeight()) / 2);
}
else
{
dc.DrawText(label, label_rect.x +
(label_rect.GetWidth() - label_size.GetWidth()) / 2,
label_rect.y +
(label_rect.GetHeight() - label_size.GetHeight()) / 2);
}
if(has_ext_button)
{
if(wnd->IsExtButtonHovered())
{
dc.SetPen(m_panel_hover_button_border_pen);
dc.SetBrush(m_panel_hover_button_background_brush);
dc.DrawRectangle(label_rect.GetRight(), label_rect.GetBottom() - 14, 14, 14);
dc.DrawBitmap(m_panel_extension_bitmap[1], label_rect.GetRight() + 3, label_rect.GetBottom() - 10, true);
}
else
dc.DrawBitmap(m_panel_extension_bitmap[0], label_rect.GetRight() + 3, label_rect.GetBottom() - 10, true);
}
}
if (wnd->GetParent()->IsKindOf(CLASSINFO(wxFrame))) // expanded panels are in their own wxFrame otherwise normal panel
{
wxRect shadow(rect);
shadow.x +=4;
shadow.y +=4;
dc.SetPen(*wxRED);
dc.DrawLine(shadow.GetBottomLeft(), shadow.GetBottomRight());
dc.DrawLine(shadow.GetTopRight(), shadow.GetBottomRight());
//.........这里部分代码省略.........
示例3: DrawTool
void wxToolBar::DrawTool( wxDC& rDc, wxToolBarToolBase* pToolBase )
{
wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
wxColour gray85( 85,85,85 );
wxPen vDarkGreyPen( gray85, 1, wxSOLID );
wxBitmap vBitmap = pTool->GetNormalBitmap();
bool bUseMask = false;
wxMask* pMask = NULL;
PrepareDC(rDc);
if (!vBitmap.Ok())
return;
if ((pMask = vBitmap.GetMask()) != NULL)
if (pMask->GetMaskBitmap() != NULLHANDLE)
bUseMask = true;
if (!pTool->IsToggled())
{
LowerTool(pTool, FALSE);
if (!pTool->IsEnabled())
{
wxColour vColor(wxT("GREY"));
rDc.SetTextForeground(vColor);
if (!pTool->GetDisabledBitmap().Ok())
pTool->SetDisabledBitmap(wxDisableBitmap( vBitmap
,(long)GetBackgroundColour().GetPixel()
));
rDc.DrawBitmap( pTool->GetDisabledBitmap()
,pTool->m_vX
,pTool->m_vY
,bUseMask
);
}
else
{
rDc.SetTextForeground(*wxBLACK);
rDc.DrawBitmap( vBitmap
,pTool->m_vX
,pTool->m_vY
,bUseMask
);
}
if (m_windowStyle & wxTB_3DBUTTONS)
{
RaiseTool(pTool);
}
if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull())
{
wxCoord vX;
wxCoord vY;
wxCoord vLeft = pTool->m_vX - (int)(pTool->GetWidth()/2);
rDc.SetFont(GetFont());
rDc.GetTextExtent( pTool->GetLabel()
,&vX
,&vY
);
if (pTool->GetWidth() > vX) // large tools
{
vLeft = pTool->m_vX + (pTool->GetWidth() - vX);
GetSize(&vX, &vY);
rDc.DrawText( pTool->GetLabel()
,vLeft
,vY - m_vTextY - 1
);
}
else // normal tools
{
vLeft += (wxCoord)((m_vTextX - vX)/2);
rDc.DrawText( pTool->GetLabel()
,vLeft
,pTool->m_vY + m_vTextY - 1 // a bit of margin
);
}
}
}
else
{
wxColour vColor(wxT("GREY"));
LowerTool(pTool);
rDc.SetTextForeground(vColor);
if (!pTool->GetDisabledBitmap().Ok())
pTool->SetDisabledBitmap(wxDisableBitmap( vBitmap
,(long)GetBackgroundColour().GetPixel()
));
rDc.DrawBitmap( pTool->GetDisabledBitmap()
,pTool->m_vX
,pTool->m_vY
,bUseMask
);
if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull())
{
wxCoord vX;
wxCoord vY;
wxCoord vLeft = pTool->m_vX - (int)(pTool->GetWidth()/2);
rDc.SetFont(GetFont());
//.........这里部分代码省略.........
示例4: if
void wxSpeedButton::Paint( wxDC &dc ) {
int n;
int w,h;
wxColour cf; // foreground color
wxColour cb; // background color
wxColour cg; // gray text
wxColour cy; // yellow
wxBrush bb; // background brush
wxPen pp; // line-drawing pen
wxBitmap bmp;
wxString s;
wxRect rr;
// get size and layout
if (! mCalcBusy) CalcLayout(false);
w = mCurrentSize.GetWidth();
h = mCurrentSize.GetHeight();
// get colors
cf = GetForegroundColour();
cb = GetBackgroundColour();
cg = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT );
cy = wxTheColourDatabase->Find(_("YELLOW"));
// use wxWidgets to draw the basic button
rr.SetX(0);
rr.SetY(0);
rr.SetWidth(w);
rr.SetHeight(h);
n = 0;
if (mMouseDown || mButtonDown) n = n | wxCONTROL_PRESSED;
if (mButtonFocused) n = n | wxCONTROL_ISDEFAULT;
wxRendererNative::Get().DrawPushButton(this, dc, rr, n);
// track mouse movements with mMouseOver using a dotted yellow line
pp = *wxBLACK_PEN;
pp.SetColour(cy);
// pp.SetStyle(wxDOT);
dc.SetPen(pp);
if (mMouseOver) {
n = 2;
dc.DrawLine( n, n, w-n, n);
dc.DrawLine(w-n, n, w-n, h-n);
dc.DrawLine(w-n, h-n, n, h-n);
dc.DrawLine( n, h-n, n, n);
};
// select the bitmap to draw
if (! IsEnabled()) bmp = mGlyphDisabled;
else if (mMouseDown || mButtonDown) bmp = mGlyphDown;
else bmp = mGlyphUp;
if (bmp.IsOk()) dc.DrawBitmap(bmp, mGlyphPos.x, mGlyphPos.y, true );
// the text label
s = GetLabelText();
if (! s.IsEmpty()) {
dc.SetFont(GetFont());
dc.SetBackgroundMode(wxTRANSPARENT);
if (! IsEnabled()) dc.SetTextForeground(cg);
else dc.SetTextForeground(cf);
dc.DrawText(s, mLabelPos.x, mLabelPos.y);
};
}
示例5: DrawSpan
void CompDateAxis::DrawSpan(wxDC &dc, wxRect rcAxis, int spanNum, wxString spanLabel, double start, double end)
{
double winMin, winMax;
GetWindowBounds(winMin, winMax);
if (end <= winMin || start >= winMax) {
return ; // span is not visible
}
wxCoord spanExtent = GetSpanExtent(dc);
wxRect rcSpan;
wxCoord minCoord, axisSize;
if (IsVertical()) {
minCoord = rcAxis.y;
axisSize = rcAxis.height;
}
else {
minCoord = rcAxis.x;
axisSize = rcAxis.width;
}
wxCoord gStart, gEnd, gCenter;
if (start <= winMin) {
gStart = minCoord;
}
else {
gStart = Axis::ToGraphics(dc, minCoord, axisSize, start);
}
if (end >= winMax) {
gEnd = minCoord + axisSize;
}
else {
gEnd = Axis::ToGraphics(dc, minCoord, axisSize, end);
}
gCenter = Axis::ToGraphics(dc, minCoord, axisSize, (start + end) / 2);
if (IsVertical()) {
rcSpan.x = rcAxis.x + spanNum * spanExtent;
rcSpan.y = gStart;
rcSpan.width = spanExtent;
rcSpan.height = gEnd - gStart;
}
else {
rcSpan.x = gStart;
rcSpan.y = rcAxis.y + spanNum * spanExtent;
rcSpan.width = gEnd - gStart;
rcSpan.height = spanExtent;
}
wxDCClipper clipper(dc, rcSpan);
m_spanDraw->Draw(dc, rcSpan);
int labelCount;
wxCoord xIncr, yIncr;
wxCoord size;
wxCoord labelGap;
wxCoord x, y;
dc.SetFont(m_labelFont);
dc.SetTextForeground(m_labelColour);
wxSize textExtent = dc.GetTextExtent(spanLabel);
if (IsVertical()) {
size = rcSpan.height;
labelCount = 1;//size / (textExtent.x + 2 * m_minLabelGap);
labelGap = 3 * m_minLabelGap + size / labelCount - textExtent.x;
xIncr = 0;
yIncr = labelGap;
x = rcSpan.x + m_labelMargin;
y = rcSpan.y + rcSpan.height - labelGap;
}
else {
size = rcSpan.width;
labelCount = 1;//size / (textExtent.x + 2 * m_minLabelGap);
labelGap = 3 * m_minLabelGap + size / labelCount - textExtent.x;
xIncr = labelGap;
yIncr = 0;
x = rcSpan.x;
y = rcSpan.y + m_labelMargin;
}
// draw span labels
for (int n = 0; n < labelCount; n++) {
if (IsVertical()) {
dc.DrawRotatedText(spanLabel, x, y, 90);
}
else {
dc.DrawText(spanLabel, x, y);
}
x += xIncr;
y += yIncr;
}
}
示例6: DrawTab
void wxRibbonAUIArtProvider::DrawTab(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRibbonPageTabInfo& tab)
{
if(tab.rect.height <= 1)
return;
dc.SetFont(m_tab_label_font);
dc.SetPen(*wxTRANSPARENT_PEN);
if(tab.active || tab.hovered)
{
if(tab.active)
{
dc.SetFont(m_tab_active_label_font);
dc.SetBrush(m_background_brush);
dc.DrawRectangle(tab.rect.x, tab.rect.y + tab.rect.height - 1,
tab.rect.width - 1, 1);
}
wxRect grad_rect(tab.rect);
grad_rect.height -= 4;
grad_rect.width -= 1;
grad_rect.height /= 2;
grad_rect.y = grad_rect.y + tab.rect.height - grad_rect.height - 1;
dc.SetBrush(m_tab_active_top_background_brush);
dc.DrawRectangle(tab.rect.x, tab.rect.y + 3, tab.rect.width - 1,
grad_rect.y - tab.rect.y - 3);
dc.GradientFillLinear(grad_rect, m_tab_active_background_colour,
m_tab_active_background_gradient_colour, wxSOUTH);
}
else
{
wxRect btm_rect(tab.rect);
btm_rect.height -= 4;
btm_rect.width -= 1;
btm_rect.height /= 2;
btm_rect.y = btm_rect.y + tab.rect.height - btm_rect.height - 1;
dc.SetBrush(m_tab_hover_background_brush);
dc.DrawRectangle(btm_rect.x, btm_rect.y, btm_rect.width,
btm_rect.height);
wxRect grad_rect(tab.rect);
grad_rect.width -= 1;
grad_rect.y += 3;
grad_rect.height = btm_rect.y - grad_rect.y;
dc.GradientFillLinear(grad_rect, m_tab_hover_background_top_colour,
m_tab_hover_background_top_gradient_colour, wxSOUTH);
}
wxPoint border_points[5];
border_points[0] = wxPoint(0, 3);
border_points[1] = wxPoint(1, 2);
border_points[2] = wxPoint(tab.rect.width - 3, 2);
border_points[3] = wxPoint(tab.rect.width - 1, 4);
border_points[4] = wxPoint(tab.rect.width - 1, tab.rect.height - 1);
dc.SetPen(m_tab_border_pen);
dc.DrawLines(sizeof(border_points)/sizeof(wxPoint), border_points, tab.rect.x, tab.rect.y);
wxRect old_clip;
dc.GetClippingBox(old_clip);
bool is_first_tab = false;
wxRibbonBar* bar = wxDynamicCast(tab.page->GetParent(), wxRibbonBar);
if(bar && bar->GetPage(0) == tab.page)
is_first_tab = true;
wxBitmap icon;
if(m_flags & wxRIBBON_BAR_SHOW_PAGE_ICONS)
{
icon = tab.page->GetIcon();
if((m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS) == 0)
{
if(icon.IsOk())
{
int x = tab.rect.x + (tab.rect.width - icon.GetWidth()) / 2;
dc.DrawBitmap(icon, x, tab.rect.y + 1 + (tab.rect.height - 1 -
icon.GetHeight()) / 2, true);
}
}
}
if(m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS)
{
wxString label = tab.page->GetLabel();
if(!label.IsEmpty())
{
dc.SetTextForeground(m_tab_label_colour);
dc.SetBackgroundMode(wxTRANSPARENT);
int offset = 0;
if(icon.IsOk())
offset += icon.GetWidth() + 2;
int text_height;
int text_width;
dc.GetTextExtent(label, &text_width, &text_height);
int x = (tab.rect.width - 2 - text_width - offset) / 2;
if(x > 8)
x = 8;
else if(x < 1)
x = 1;
int width = tab.rect.width - x - 2;
x += tab.rect.x + offset;
int y = tab.rect.y + (tab.rect.height - text_height) / 2;
//.........这里部分代码省略.........
示例7: DrawPartialPanelBackground
void wxRibbonAUIArtProvider::DrawPartialPanelBackground(wxDC& dc,
wxWindow* wnd, const wxRect& rect)
{
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_background_brush);
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
wxPoint offset(wnd->GetPosition());
wxWindow* parent = wnd->GetParent();
wxRibbonPanel* panel = NULL;
for(; parent; parent = parent->GetParent())
{
panel = wxDynamicCast(parent, wxRibbonPanel);
if(panel != NULL)
{
if(!panel->IsHovered())
return;
break;
}
offset += parent->GetPosition();
}
if(panel == NULL)
return;
wxRect background(panel->GetSize());
RemovePanelPadding(&background);
background.x++;
background.width -= 2;
dc.SetFont(m_panel_label_font);
int caption_height = dc.GetTextExtent(panel->GetLabel()).GetHeight() + 7;
background.y += caption_height - 1;
background.height -= caption_height;
wxRect paint_rect(rect);
paint_rect.x += offset.x;
paint_rect.y += offset.y;
wxColour bg_clr, bg_grad_clr;
#ifdef __WXMAC__
bg_grad_clr = m_page_hover_background_colour;
bg_clr = m_page_hover_background_gradient_colour;
#else
bg_clr = m_page_hover_background_colour;
bg_grad_clr = m_page_hover_background_gradient_colour;
#endif
paint_rect.Intersect(background);
if(!paint_rect.IsEmpty())
{
wxColour starting_colour(wxRibbonInterpolateColour(bg_clr, bg_grad_clr,
paint_rect.y, background.y, background.y + background.height));
wxColour ending_colour(wxRibbonInterpolateColour(bg_clr, bg_grad_clr,
paint_rect.y + paint_rect.height, background.y,
background.y + background.height));
paint_rect.x -= offset.x;
paint_rect.y -= offset.y;
dc.GradientFillLinear(paint_rect, starting_colour, ending_colour
, wxSOUTH);
}
}
示例8: render
void CtrlRegisterList::render(wxDC& dc)
{
#ifdef WIN32
wxFont font = wxFont(wxSize(charWidth,rowHeight-2),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console");
#else
wxFont font = wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console");
font.SetPixelSize(wxSize(charWidth,rowHeight-2));
#endif
dc.SetFont(font);
// clear background
wxColor white = wxColor(0xFFFFFFFF);
dc.SetBrush(wxBrush(white));
dc.SetPen(wxPen(white));
wxSize size = GetSize();
dc.DrawRectangle(0,0,size.x,size.y);
refreshChangedRegs();
wxColor colorChanged = wxColor(0xFF0000FF);
wxColor colorUnchanged = wxColor(0xFF004000);
wxColor colorNormal = wxColor(0xFF600000);
// draw categories
int piece = size.x/cpu->getRegisterCategoryCount();
for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)
{
const char* name = cpu->getRegisterCategoryName(i);
int x = i*piece;
if (i == category)
{
dc.SetBrush(wxBrush(wxColor(0xFF70FF70)));
dc.SetPen(wxPen(wxColor(0xFF000000)));
} else {
dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));
dc.SetPen(wxPen(wxColor(0xFF000000)));
}
dc.DrawRectangle(x-1,-1,piece+1,rowHeight+1);
// center text
x += (piece-strlen(name)*charWidth)/2;
dc.DrawText(wxString(name,wxConvUTF8),x,1);
}
int nameStart = 17;
int valueStart = startPositions[category];
ChangedReg* changedRegs = changedCategories[category];
int registerBits = cpu->getRegisterSize(category);
DebugInterface::RegisterType type = cpu->getRegisterType(category);
for (int i = 0; i < cpu->getRegisterCount(category); i++)
{
int x = valueStart;
int y = rowHeight*(i+1);
if (currentRows[category] == i)
{
dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));
dc.SetPen(wxPen(wxColor(0xFFFFEFE8)));
dc.DrawRectangle(0,y,size.x,rowHeight);
}
const char* name = cpu->getRegisterName(category,i);
dc.SetTextForeground(colorNormal);
dc.DrawText(wxString(name,wxConvUTF8),nameStart,y+2);
u128 value = cpu->getRegister(category,i);
ChangedReg& changed = changedRegs[i];
switch (type)
{
case DebugInterface::NORMAL: // display them in 32 bit parts
switch (registerBits)
{
case 128:
{
int startIndex = std::min<int>(3,maxBits/32-1);
int actualX = size.x-4-(startIndex+1)*(8*charWidth+2);
x = std::max<int>(actualX,x);
if (startIndex != 3)
{
bool c = false;
for (int i = 3; i > startIndex; i--)
c = c || changed.changed[i];
if (c)
{
dc.SetTextForeground(colorChanged);
dc.DrawText(L"+",x-charWidth,y+2);
}
}
for (int i = startIndex; i >= 0; i--)
//.........这里部分代码省略.........
示例9: DrawPins
void ChipPackage::DrawPins(wxDC& dc, const wxPoint& pt, unsigned int PackageLen,
unsigned int FirstPin, unsigned int LastPin,
int flags,
wxDirection dir)
{
wxASSERT_MSG(LastPin>FirstPin, "invalid pin indexes");
// NOTE: inside this function context
// pin number == the index of the pin (e.g. "1", "2", etc)
// pin name == pin label == the name of the pin signal (e.g. "VCC", "GND" etc)
// pin == pin rectangle
// some drawing constants:
const unsigned int PinCount = LastPin - FirstPin;
// pin height is calculated imposing that
// 1) PinCount*PinH + (PinCount+1)*PinSpacing = PackageLen
// 2) PinSpacing = PinH/2
// solving for PinH yields:
unsigned int PinH = (unsigned int)floor(2*PackageLen/(3.0*PinCount+1));
unsigned int PinW = (unsigned int)1.5*PinH;
const unsigned int PinSpacing = (const unsigned int)floor(PinH/2.0);
// the error which force us to have a "pin y offset" is caused by rounding
// in the calculation of PinH:
const int PinOffset = (PackageLen - (PinCount*PinH + (PinCount+1)*PinSpacing))/2;
wxASSERT(PinOffset>=0);
if (int(PinH*0.8) == 0)
return; // this happens for very small package sizes;
// the check avoids an assertion failure from wxFont ctor
// select a font suitable for the PinH we have computed above:
int fSize = int(PinH*0.8);
if(fSize>12)fSize=12;
wxFont fnt(wxSize(0,fSize), wxFONTFAMILY_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
dc.SetFont(fnt);
const unsigned int PinNumberW = 2*dc.GetCharWidth();
const unsigned int PinNumberH = dc.GetCharHeight();
bool invertOrder = (flags & DRAWPIN_INVERTED_ORDER) != 0;
unsigned int start = invertOrder ? LastPin-1 : FirstPin;
unsigned int end = invertOrder ? FirstPin-1 : LastPin;
int inc = invertOrder ? -1 : +1;
if (dir == wxLEFT || dir == wxRIGHT)
{
unsigned int PinX = (dir == wxLEFT) ? pt.x-PinW+1 : pt.x-1;
unsigned int PinY = pt.y + PinOffset + PinSpacing;
unsigned int PinNumberX = (dir == wxLEFT) ?
pt.x+PinSpacing : pt.x-PinNumberW-PinSpacing;
if (flags & DRAWPIN_NUMBERS_INSIDE_PINS)
PinNumberX = PinX + (PinW-PinNumberW)/2;
// draw the pins organizing them in a vertical column
for (unsigned int i=start; i != end; i+=inc)
{
unsigned int PinNumberY = PinY + (PinH-PinNumberH)/2;
unsigned int pinLabelX = (dir == wxLEFT) ?
PinX-PinSpacing-dc.GetTextExtent(PinNames[i]).GetWidth() :
PinX+PinW+PinSpacing;
unsigned int pinLabelY = PinNumberY;
// draw the pin rect
dc.DrawRectangle(PinX, PinY, PinW, PinH);
// print the pin number
dc.SetTextForeground(IsICSPPin(i) ? *wxRED : *wxBLACK);
dc.DrawText(wxString::Format(("%d"), i+1), PinNumberX, PinNumberY);
// print the pin name
dc.DrawText(PinNames[i], pinLabelX, pinLabelY);
PinY += PinH+PinSpacing;
}
}
else if (dir == wxTOP || dir == wxBOTTOM)
{
SWAP(PinH, PinW, unsigned int);
// in this case the PackageLen is the number of horizontal pixels available
// for drawing the pin strip; thus we want to compute PinW and set PinH
// VERY IMPORTANT: the code below is the dual of the code for wxLEFT|wxRIGHT case!
// If you change something here, you may want to change it also
// above, with the appropriate differences
// NOTE: remember however that the text is drawn rotated by 90 degrees
unsigned int PinX = pt.x + PinOffset + PinSpacing;
unsigned int PinY = (dir == wxTOP) ? pt.y-PinH+1 : pt.y-1;
unsigned int PinNumberY = (dir == wxTOP) ?
pt.y+PinSpacing : pt.y-PinNumberH-PinSpacing;
if (flags & DRAWPIN_NUMBERS_INSIDE_PINS)
//.........这里部分代码省略.........
示例10: show
void SeqDNA::show ( wxDC& dc )
{
if ( useDirectRoutines() ) { show_direct ( dc ) ; return ; }
dc.SetFont(*can->font);
wxColour tbg = dc.GetTextBackground () ;
wxColour tfg = dc.GetTextForeground () ;
int bm = dc.GetBackgroundMode () ;
int a , b , cnt = offset+1 ;
wxString t ;
char u[100] , valid[256] ;
for ( a = 0 ; a < 256 ; a++ ) valid[a] = 0 ;
valid['A'] = valid['C'] = valid['T'] = valid['G'] = valid[' '] = 1 ;
// dc.SetTextBackground ( *wxWHITE ) ;
dc.SetTextForeground ( fontColor ) ;
// dc.SetBackgroundMode ( wxSOLID ) ;
dc.SetBackgroundMode ( wxTRANSPARENT ) ;
int xa , ya , yb ;
dc.GetDeviceOrigin ( &xa , &ya ) ;
ya = -ya ;
can->MyGetClientSize ( &xa , &yb ) ;
yb += ya ;
for ( a = 0 ; a < pos.p.GetCount() ; a++ )
{
if ( can->hardstop > -1 && a > can->hardstop ) break ;
b = pos.p[a] ;
int tx = pos.r[a].x , ty = pos.r[a].y ;
int tz = ty + can->charheight ;
bool insight = true ; // Meaning "is this part visible"
if ( tz < ya ) insight = false ;
if ( ty > yb ) insight = false ;
if ( can->getDrawAll() ) insight = true ;
if ( !insight && ty > yb ) a = pos.p.GetCount() ;
if ( b > 0 && !insight ) cnt++ ;
if ( b > 0 && insight ) // Character
{
t = s.GetChar(b-1) ;
int pm = getMark ( a ) ;
if ( pm == 1 ) // Marked (light gray background)
{
dc.SetBackgroundMode ( wxSOLID ) ;
dc.SetTextBackground ( *wxLIGHT_GREY ) ;
dc.SetTextForeground ( *wxBLACK ) ;
}
else if ( pm == 2 && can->doOverwrite() ) // Overwrite cursor
{
dc.SetBackgroundMode ( wxSOLID ) ;
dc.SetTextBackground ( *wxBLACK ) ;
}
if ( pm == 2 && can->doOverwrite() ) dc.SetTextForeground ( *wxWHITE ) ;
else dc.SetTextForeground ( getBaseColor ( t.GetChar(0) ) ) ;
if ( can->isPrinting() && pm == 1 )
{
dc.SetBrush ( *MYBRUSH ( wxColour ( 230 , 230 , 230 ) ) ) ;
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle ( tx , ty , can->charwidth , can->charheight ) ;
}
if ( can->isPrinting() && !can->getPrintToColor() )
{
dc.SetBackgroundMode ( wxTRANSPARENT ) ;
dc.SetTextForeground ( *wxBLACK ) ;
}
dc.DrawText ( t , tx , ty ) ;
if ( pm == 2 && !can->doOverwrite() ) // Insert cursor
{
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine ( tx-1 , ty , tx-1 , tz ) ;
dc.DrawLine ( tx-3 , ty , tx+2 , ty ) ;
dc.DrawLine ( tx-3 , tz , tx+2 , tz ) ;
}
if ( pm > 0 ) // Reverting cursor settings
{
dc.SetBackgroundMode ( wxTRANSPARENT ) ;
dc.SetTextForeground ( fontColor ) ;
}
cnt++ ;
}
else if ( insight ) // Front number
{
if ( showNumbers )
{
//sprintf ( u , "%d" , cnt ) ;
//t = u ;
t = wxString::Format ( _T("%d") , cnt ) ;
while ( t.length() < endnumberlength ) t = _T("0") + t ;
}
else t = alternateName ;
dc.SetTextForeground ( *wxBLACK ) ;
dc.DrawText ( t , pos.r[a].x, pos.r[a].y ) ;
}
}
dc.SetBackgroundMode ( bm ) ;
dc.SetTextBackground ( tbg ) ;
dc.SetTextForeground ( tfg ) ;
}
示例11: show_direct
void SeqDNA::show_direct ( wxDC& dc )
{
myass ( itemsperline , "DNA:show_direct_ipl" ) ;
if ( !itemsperline ) return ;
myass ( can , "SeqDNA::show_direct1" ) ;
can->SetFont(*can->font);
dc.SetFont(*can->font);
int a , b , w , h , n , bo = can->border ;
int csgc = can->NumberOfLines() , cbs = can->blocksize ;
int cih = can->isHorizontal() ;
int xa , xb , ya , yb ;
for ( n = 0 ; n < can->seq.GetCount() && can->seq[n] != this ; n++ ) ;
if ( n == can->seq.GetCount() ) return ;
// Setting basic values
int cw = can->charwidth , ch = can->charheight ;
int ox = bo + cw + cw * endnumberlength ;
int oy = n*ch+bo ;
bool isPrimer = false ;
if ( whatsthis().StartsWith ( _T("PRIMER") ) ) isPrimer = true ;
can->MyGetClientSize ( &w , &h ) ;
xb = w ;
yb = h ;
wxColour tbg = dc.GetTextBackground () ;
wxColour tfg = dc.GetTextForeground () ;
int bm = dc.GetBackgroundMode () ;
dc.SetTextForeground ( fontColor ) ;
dc.SetBackgroundMode ( wxTRANSPARENT ) ;
dc.GetDeviceOrigin ( &xa , &ya ) ;
xa = -xa ;
xb += xa ;
ya = -ya ;
yb += ya ;
myass ( ch , "SeqDNA::show_direct2a" ) ;
myass ( csgc , "SeqDNA::show_direct2b" ) ;
b = ( ya - ch - oy ) / ( ch * csgc ) * itemsperline ;
for ( a = 0 ; a < b && a < s.length() ; a += itemsperline ) ;
myass ( itemsperline , "SeqDNA::show_direct3" ) ;
myass ( cbs , "SeqDNA::show_direct4" ) ;
for ( a = 0 ; a < s.length() ; a++ )
{
int px = a % itemsperline , py = a / itemsperline ;
bool showNumber = ( px == 0 ) ;
px = px * cw + ( px / cbs ) * ( cw - 1 ) + ox ;
py = py * ch * csgc + oy ;
if ( !can->getDrawAll() )
{
if ( py + ch < ya ) continue ;
if ( py > yb ) break ;
if ( cih )
{
if ( px + cw < xa ) continue ;
if ( px > xb ) continue ;
}
}
int pm = getMark ( a ) ;
char ac = s.GetChar(a) ;
if ( pm == 0 && !showNumber && ac == ' ' ) continue ;
if ( pm == 1 ) // Marked (light gray background)
{
dc.SetBackgroundMode ( wxSOLID ) ;
dc.SetTextBackground ( *wxLIGHT_GREY ) ;
dc.SetTextForeground ( *wxBLACK ) ;
}
else if ( pm == 2 && can->doOverwrite() ) // Overwrite cursor
{
dc.SetBackgroundMode ( wxSOLID ) ;
dc.SetTextBackground ( *wxBLACK ) ;
dc.SetTextForeground ( *wxWHITE ) ;
}
else dc.SetTextForeground ( getHighlightColor ( a , getBaseColor ( ac ) ) ) ;
if ( isPrimer )
{
if ( s.GetChar(a) == vec->getSequenceChar(a) ) dc.SetTextForeground ( *wxBLUE ) ;
else dc.SetTextForeground ( *wxRED ) ;
}
if ( can->isPrinting() && pm == 1 )
{
dc.SetBrush ( *MYBRUSH ( wxColour ( 230 , 230 , 230 ) ) ) ;
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle ( px , py , cw , ch ) ;
}
if ( can->isPrinting() && !can->getPrintToColor() )
{
dc.SetBackgroundMode ( wxTRANSPARENT ) ;
dc.SetTextForeground ( *wxBLACK ) ;
}
dc.DrawText ( wxString ( (wxChar) ac ) , px , py ) ;
//.........这里部分代码省略.........
示例12: 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);
//.........这里部分代码省略.........
示例13: DrawImage
//////////////
// Draw image
void BaseGrid::DrawImage(wxDC &dc) {
dc.BeginDrawing();
// Get size and pos
int w = 0;
int h = 0;
GetClientSize(&w,&h);
// Set font
dc.SetFont(font);
// Clear background
dc.SetBackground(wxBrush(Options.AsColour(_T("Grid Background"))));
dc.Clear();
// Draw labels
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(Options.AsColour(_T("Grid left column"))));
dc.DrawRectangle(0,lineHeight,colWidth[0],h-lineHeight);
// Visible lines
int drawPerScreen = h/lineHeight + 1;
int nDraw = MID(0,drawPerScreen,GetRows()-yPos);
int maxH = (nDraw+1) * lineHeight;
// Row colors
std::vector<wxBrush> rowColors;
std::vector<wxColor> foreColors;
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid Background")))); // 0 = Standard
foreColors.push_back(Options.AsColour(_T("Grid standard foreground")));
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid Header")))); // 1 = Header
foreColors.push_back(Options.AsColour(_T("Grid standard foreground")));
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid selection background")))); // 2 = Selected
foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid comment background")))); // 3 = Commented
foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid inframe background")))); // 4 = Video Highlighted
foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid selected comment background")))); // 5 = Commented & selected
foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));
// First grid row
bool drawGrid = true;
if (drawGrid) {
dc.SetPen(wxPen(Options.AsColour(_T("Grid lines"))));
dc.DrawLine(0,0,w,0);
dc.SetPen(*wxTRANSPARENT_PEN);
}
// Draw rows
int dx = 0;
int dy = 0;
int curColor = 0;
AssDialogue *curDiag;
for (int i=0;i<nDraw+1;i++) {
// Prepare
int curRow = i+yPos-1;
curDiag = GetDialogue(curRow);
dx = 0;
dy = i*lineHeight;
// Check for collisions
bool collides = false;
if (curDiag) {
AssDialogue *sel = GetDialogue(editBox->linen);
if (sel && sel != curDiag) {
if (curDiag->CollidesWith(sel)) collides = true;
}
}
// Text array
wxArrayString strings;
// Header
if (i == 0) {
strings.Add(_("#"));
strings.Add(_("L"));
strings.Add(_("Start"));
strings.Add(_("End"));
strings.Add(_("Style"));
strings.Add(_("Actor"));
strings.Add(_("Effect"));
strings.Add(_("Left"));
strings.Add(_("Right"));
strings.Add(_("Vert"));
strings.Add(_("Text"));
curColor = 1;
}
// Lines
else if (curDiag) {
// Set fields
strings.Add(wxString::Format(_T("%i"),curRow+1));
strings.Add(wxString::Format(_T("%i"),curDiag->Layer));
if (byFrame) {
strings.Add(wxString::Format(_T("%i"),VFR_Output.GetFrameAtTime(curDiag->Start.GetMS(),true)));
strings.Add(wxString::Format(_T("%i"),VFR_Output.GetFrameAtTime(curDiag->End.GetMS(),true)));
}
//.........这里部分代码省略.........
示例14: OnDraw
void CtrlRegisterList::OnDraw(wxDC& dc)
{
#ifdef _WIN32
wxFont font = wxFont(wxSize(charWidth,rowHeight-2),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console");
#else
wxFont font = wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console");
font.SetPixelSize(wxSize(charWidth,rowHeight-2));
#endif
dc.SetFont(font);
refreshChangedRegs();
wxColor colorChanged = wxColor(0xFF0000FF);
wxColor colorUnchanged = wxColor(0xFF004000);
wxColor colorNormal = wxColor(0xFF600000);
int startRow;
GetViewStart(nullptr,&startRow);
int endRow = startRow + ceil(float(GetClientSize().y) / rowHeight);
// draw categories
int width = GetClientSize().x;
if (startRow == 0)
{
int piece = width /cpu->getRegisterCategoryCount();
for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)
{
const char* name = cpu->getRegisterCategoryName(i);
int x = i*piece;
if (i == category)
{
dc.SetBrush(wxBrush(wxColor(0xFF70FF70)));
dc.SetPen(wxPen(wxColor(0xFF000000)));
} else {
dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));
dc.SetPen(wxPen(wxColor(0xFF000000)));
}
if (i == cpu->getRegisterCategoryCount()-1)
piece += width-piece*cpu->getRegisterCategoryCount()-1;
dc.DrawRectangle(x,0,piece+1,rowHeight);
// center text
x += (piece-strlen(name)*charWidth)/2;
dc.DrawText(wxString(name,wxConvUTF8),x,2);
}
}
// skip the tab row
startRow = std::max<int>(0,startRow-1);
endRow = std::min<int>(cpu->getRegisterCount(category)-1,endRow-1);
int nameStart = 17;
int valueStart = startPositions[category];
ChangedReg* changedRegs = changedCategories[category];
int registerBits = cpu->getRegisterSize(category);
DebugInterface::RegisterType type = cpu->getRegisterType(category);
for (int i = startRow; i <= endRow; i++)
{
int x = valueStart;
int y = rowHeight*(i+1);
wxColor backgroundColor;
if (currentRows[category] == i)
backgroundColor = wxColor(0xFFFFCFC8);
else if (i % 2)
backgroundColor = wxColor(237, 242, 255, 255);
else
backgroundColor = wxColor(0xFFFFFFFF);
dc.SetBrush(backgroundColor);
dc.SetPen(backgroundColor);
dc.DrawRectangle(0, y, width, rowHeight);
const char* name = cpu->getRegisterName(category,i);
dc.SetTextForeground(colorNormal);
dc.DrawText(wxString(name,wxConvUTF8),nameStart,y+2);
u128 value = cpu->getRegister(category,i);
ChangedReg& changed = changedRegs[i];
switch (type)
{
case DebugInterface::NORMAL: // display them in 32 bit parts
switch (registerBits)
{
case 128:
{
int startIndex = std::min<int>(3, maxBits / 32 - 1);
if (resolvePointerStrings && cpu && cpu->isAlive()) {
char *strval = cpu->stringFromPointer(value._u32[0]);
if (strval) {
static wxColor clr = wxColor(0xFF228822);
dc.SetTextForeground(clr);
//.........这里部分代码省略.........
示例15: drawArgs
// -----------------------------------------------------------------------------
// Draws function args text for [context] at [left,top].
// Returns a rect of the bounds of the drawn text
// -----------------------------------------------------------------------------
wxRect SCallTip::drawArgs(
wxDC& dc,
const TLFunction::Context& context,
int left,
int top,
wxColour& col_faded,
wxFont& bold) const
{
wxRect rect{ left, top, 0, 0 };
int max_right = left;
int args_left = left;
int args_top = top;
size_t params_lenght = 0;
for (const auto& param : context.params)
{
// Count param name + space length
if (!param.type.empty())
params_lenght += param.name.size() + 1;
// Count param type + space length
if (!param.type.empty())
params_lenght += param.type.size() + 1;
// Count param default_value + " = " length
if (!param.default_value.empty())
params_lenght += param.default_value.size() + 3;
// Count brackets for optional params
if (param.optional)
params_lenght += 2;
}
if (context.params.empty())
params_lenght = 4; // void
params_lenght *= UI::scalePx(font_.GetPixelSize().GetWidth());
bool long_params = (args_left + params_lenght) > MAX_WIDTH;
for (int a = 0; a < (int)context.params.size(); a++)
{
auto& arg = context.params[a];
// Go down to next line if current is too long
if ((a != 0 && (long_params && !(a % 2))) || left > MAX_WIDTH)
{
left = args_left;
top = rect.GetBottom() + UI::scalePx(2);
}
// Set highlight colour if current arg
if (a == arg_current_)
{
dc.SetTextForeground(wxcol_fg_hl);
dc.SetFont(bold);
}
// Optional opening bracket
if (arg.optional && !txed_calltips_dim_optional)
left = drawText(dc, "[", left, top, &rect);
// Type
if (!arg.type.empty())
{
wxString arg_type = arg.type == "void" ? "void" : wxString::Format("%s ", arg.type);
if (a != arg_current_)
dc.SetTextForeground(wxcol_type);
left = drawText(dc, arg_type, left, top, &rect);
}
// Name
if (a != arg_current_)
dc.SetTextForeground(arg.optional ? col_faded : wxcol_fg); // Faded text if optional
left = drawText(dc, arg.name, left, top, &rect);
// Default value
if (!arg.default_value.empty())
left = drawText(dc, wxString::Format(" = %s", arg.default_value), left, top, &rect);
// Optional closing bracket
if (arg.optional && !txed_calltips_dim_optional)
left = drawText(dc, "]", left, top, &rect);
// Comma (if needed)
dc.SetFont(font_);
dc.SetTextForeground(wxcol_fg);
if (a < (int)context.params.size() - 1)
left = drawText(dc, ", ", left, top, &rect);
// Update max width
max_right = std::max(max_right, rect.GetRight());
}
//.........这里部分代码省略.........