本文整理汇总了C++中wxMemoryDC::SetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMemoryDC::SetFont方法的具体用法?C++ wxMemoryDC::SetFont怎么用?C++ wxMemoryDC::SetFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxMemoryDC
的用法示例。
在下文中一共展示了wxMemoryDC::SetFont方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawBackground
void FreqWindow::DrawBackground(wxMemoryDC & dc)
{
Layout();
if (mBitmap)
{
delete mBitmap;
mBitmap = NULL;
}
mPlotRect = mFreqPlot->GetClientRect();
mBitmap = new wxBitmap(mPlotRect.width, mPlotRect.height);
dc.SelectObject(*mBitmap);
dc.SetBackground(wxBrush(wxColour(254, 254, 254)));// DONT-THEME Mask colour.
dc.Clear();
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(mPlotRect);
dc.SetFont(mFreqFont);
}
示例2: SetFont
//set the font on memDC such that text can fit in specified width and height
void ExportMixerPanel::SetFont( wxMemoryDC &memDC, wxString text, int width,
int height )
{
int l = 0, u = 13, m, w, h;
wxFont font = memDC.GetFont();
while( l < u - 1 )
{
m = ( l + u ) / 2;
font.SetPointSize( m );
memDC.SetFont( font );
memDC.GetTextExtent( text, &w, &h );
if( w < width && h < height )
l = m;
else
u = m;
}
font.SetPointSize( l );
memDC.SetFont( font );
}
示例3: DrawBackground
void FreqWindow::DrawBackground(wxMemoryDC & dc)
{
Layout();
mBitmap.reset();
mPlotRect = mFreqPlot->GetClientRect();
mBitmap = std::make_unique<wxBitmap>(mPlotRect.width, mPlotRect.height);
dc.SelectObject(*mBitmap);
dc.SetBackground(wxBrush(wxColour(254, 254, 254)));// DONT-THEME Mask colour.
dc.Clear();
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(mPlotRect);
dc.SetFont(mFreqFont);
}
示例4: drawTable
// NOTES:(1) store values of width & height at queryTable.
// (2)Need to set a font for the device context before get font metrics with GetTextExtent
void gqbGraphSimple::drawTable(wxMemoryDC& bdc, wxPoint *origin, gqbQueryObject *queryTable)
{
long w=0,h=0,height=0,width=0,margin=5;
// Get Value for row Height
if(!rowHeight)
{
bdc.SetFont(TableTitleFont);
bdc.GetTextExtent(wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxtz"),&w,&h);
rowHeight=h;
}
// Get Title Metrics
bdc.SetFont(TableTitleFont);
height+= rowHeight + rowTopMargin;
// Calculate font metrics for table title with/without alias
if(queryTable->getAlias().length()>0)
bdc.GetTextExtent(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),&w,&h);
else
bdc.GetTextExtent(queryTable->getName(),&w,&h);
width= rowLeftMargin + w + rowRightMargin;
// Get Columns Metrics
bdc.SetFont(normalFont);
// Don't use h value from font metrics to get consistency between columns vertical separation (height)
height+=rowHeight*queryTable->parent->countCols()+rowTopMargin*queryTable->parent->countCols();
gqbIteratorBase *iterator = queryTable->parent->createColumnsIterator();
while(iterator->HasNext())
{
gqbColumn *tmp= (gqbColumn *)iterator->Next();
bdc.GetTextExtent(tmp->getName(),&w,&h);
if((rowLeftMargin + w + rowRightMargin) > width)
width=rowLeftMargin + w + rowRightMargin;
}
//Don't delete iterator because will be use below;
// Set table Size in ObjectModel (Temporary Values for object representation,
// and for this reason the view can modified model without using the controller
// because this values are used by controller when use object's size in internal operations)
if( (height+2) < minTableHeight) // +2 from BackgroundLayers addition
{
queryTable->setHeight(minTableHeight);
height=minTableHeight;
}
else
queryTable->setHeight(height+2);
if( (width+2) < minTableWidth)
{
queryTable->setWidth(minTableWidth);
width=minTableWidth;
}
else
queryTable->setWidth(width+2);
//Decorate Table
bdc.SetPen(*wxTRANSPARENT_PEN);
//draw second Layer
bdc.SetBrush(BackgroundLayer2);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+2,height+2)));
//draw third Layer
bdc.SetBrush(BackgroundLayer1);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+1,height+1)));
//draw real frame layer
bdc.SetBrush(*wxWHITE_BRUSH);
if(queryTable->getSelected())
{
bdc.SetPen(selectedPen);
}
else
{
bdc.SetPen(*wxBLACK_PEN);
}
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,height)));
//draw title layer
bdc.SetBrush(BackgroundTitle);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,rowHeight+rowTopMargin)));
bdc.SetFont(TableTitleFont);
if(queryTable->getAlias().length()>0)
bdc.DrawText(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),origin->x+margin,origin->y+rowTopMargin);
else
bdc.DrawText(queryTable->getName(),origin->x+margin,origin->y+rowTopMargin);
bdc.SetFont(normalFont);
// GQB-TODO: in a future reuse a little more the iterator creating it inside the Query or Table Object
// and only delete it when delete the query object.
// Draw Columns
height=rowHeight+rowTopMargin;
iterator->ResetIterator();
while(iterator->HasNext())
//.........这里部分代码省略.........
示例5: Paint
void wxListSelection::Paint(wxMemoryDC &dc)
{
const StringArray &displayOrder = mParent->GetDisplayOrder();
wxASSERT(false == displayOrder.empty());
wxASSERT(displayOrder.size() == mpImpl->mPoints.size());
wxSize size = GetSize();
wxColour background = mpImpl->mBackground;
// Set background color.
if(mpImpl->mIsHighlight && mpImpl->mIsSelected)
{
background = mpImpl->mHighlightAndSelected;
}
else if(mpImpl->mIsHighlight)
{
background = mpImpl->mHighlight;
}
else if(mpImpl->mIsSelected)
{
background = mpImpl->mSelected;
}
dc.SetPen(wxPen(background));
dc.SetBrush(wxBrush(background));
dc.DrawRectangle(0, 0, size.x, size.y);
// Bitmap (if any)
if(true == mpImpl->mBitmap.Ok())
{
dc.DrawBitmap(mpImpl->mBitmap, sImageBufferX, mpImpl->mImageBufferY, true);
}
// Draw text.
dc.SetFont(mpImpl->mMainFont);
wxColour shadow = mpImpl->mMainTextShadow;
wxColour main = IsEnabled() ? mpImpl->mMainText :
mpImpl->mMainTextDisabled;
for(size_t i = 0; i < displayOrder.size(); ++i)
{
if(1 == i)
{
dc.SetFont(mpImpl->mSubFont);
shadow = mpImpl->mSubTextShadow;
main = mpImpl->mSubText;
}
const wxString &str = mpImpl->mFields[displayOrder[i]];
if(false == str.IsEmpty())
{
const wxPoint &point = mpImpl->mPoints[i];
if(shadow != mpImpl->mTransparent)
{
dc.SetTextForeground(shadow);
dc.DrawText(str, point.x + 1, point.y + 1);
}
dc.SetTextForeground(main);
dc.DrawText(str, point.x, point.y);
}
}
}