本文整理汇总了C++中CWindowGc::DiscardFont方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc::DiscardFont方法的具体用法?C++ CWindowGc::DiscardFont怎么用?C++ CWindowGc::DiscardFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWindowGc
的用法示例。
在下文中一共展示了CWindowGc::DiscardFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTexts
void CZXingBarcodeReaderAppView::DrawTexts(CWindowGc& gc) const
{
if (iTitle.Length()>0)
{
TRect rect(Rect());
gc.SetPenColor(KRgbWhite);
gc.UseFont(iTitleFont);
gc.DrawText(iTitle, rect, rect.Height()/10, CGraphicsContext::ECenter );
gc.DiscardFont();
}
}
示例2: WriteName
void CMultiPtrTestChildControl::WriteName( CWindowGc& aGc, const TDesC& aText ) const
{
TRect rect = Rect();
rect.Shrink( 3, 3 );
aGc.UseFont( iFont );
TInt ascent = ( rect.iBr.iY - rect.iTl.iY-iFont->HeightInPixels() ) / 2 + iFont->AscentInPixels();
aGc.SetPenColor( KRgbBlack );
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
aGc.DrawText( aText, rect, ascent, CGraphicsContext::ELeft );
aGc.DiscardFont();
}
示例3: Draw
/****************************************************************************\
| Function: CNumberedWindow::Draw
| Purpose: Redraws the contents of CNumberedWindow within a given
| rectangle. CNumberedWindow displays a number in the window.
| Input: aRect Rectangle that needs redrawing
| Output: None
\****************************************************************************/
void CNumberedWindow::Draw(const TRect& aRect)
{
const TBufC<1> strings[5] =
{
*&KString1, *&KString2, *&KString3, *&KString4, *&KString5
};
CWindowGc* gc = SystemGc(); // get a graphics context
gc->SetClippingRect(aRect); // clip outside the redraw area
gc->Clear(aRect); // clear the redraw area
TSize size = iWindow.Size();
TInt height = size.iHeight; // Need window height to calculate vertical text offset
TInt ascent = Font()->AscentInPixels();
TInt descent = Font()->DescentInPixels();
TInt offset = (height + (ascent + descent)) / 2; // Calculate vertical text offset
gc->SetPenColor(TRgb(0, 0, 0)); // Set pen to black
gc->UseFont(Font());
gc->DrawText(strings[iNumber], TRect(TPoint(0, 0), size), offset,
CGraphicsContext::ECenter);
gc->DiscardFont();
}