本文整理汇总了C++中CFont::AscentInPixels方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::AscentInPixels方法的具体用法?C++ CFont::AscentInPixels怎么用?C++ CFont::AscentInPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::AscentInPixels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
EXPORT_C void CXzePicture::Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const
// Draw this simple picture.
//
{
aGc.Reset();
aGc.SetClippingRect(aClipRect);
TSize size; // Size of graphics device in pixels
GetSizeInPixels(aMap,size);
TRect box; // The rectangle that exactly fits the picture
box.iTl=aTopLeft;
box.iBr.iX=aTopLeft.iX+size.iWidth;
box.iBr.iY=aTopLeft.iY+size.iHeight;
TRgb white(255,255,255);
// First draw outer box and fill in rest of box.
aGc.SetBrushColor(white);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.DrawRect(box);
// Now draw label
CFont* font;
TFontSpec fontSpec(_L("Arial"),213);
if (aMap->GetNearestFontInTwips(font,fontSpec)<0)
{
return;
}
aGc.UseFont(font);
TBuf<1> label;
label.Append(iLabel);
TInt baselineOffset=(box.Height()+font->AscentInPixels())/2;
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
aGc.DrawText(label,box,baselineOffset,CGraphicsContext::ECenter);
aGc.DiscardFont();
aMap->ReleaseFont(font);
}
示例2: Draw
void CHelloControl::Draw(const TRect& /* aRect */) const
{
// draw surrounding rectangle
SystemGc().DrawRect(Rect());
// calculate rectangle to draw into
TRect rect = Rect();
rect.Shrink(1, 1);
// calculate vertical centering
CFont *font = iMessageFont;
TInt ascent = (rect.Height() - font->HeightInPixels()) / 2
+ font->AscentInPixels();
// draw text in rectangle
CWindowGc& gc = SystemGc();
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.UseFont(iMessageFont);
switch (Phase())
{
case 0:
gc.DrawText(KTxtDrawCase0, rect, ascent, CGraphicsContext::ECenter,
0);
break;
case 1:
gc.DrawText(KTxtDrawCase1, rect, ascent, CGraphicsContext::ECenter,
0);
break;
case 2:
gc.DrawText(KTxtDrawCase2, rect, ascent, CGraphicsContext::ECenter,
0);
break;
case 3:
gc.DrawText(KTxtDrawCase3, rect, ascent, CGraphicsContext::ECenter,
0);
break;
case 4:
gc.DrawText(KTxtDrawCase4, rect, ascent, CGraphicsContext::ECenter,
0);
break;
case 5:
gc.DrawText(KTxtDrawCase5, rect, ascent, CGraphicsContext::ECenter,
0);
break;
case 6:
gc.DrawText(KTxtDrawCase6, rect, ascent, CGraphicsContext::ECenter,
0);
break;
default:
break;
};
}
示例3: Draw
void CPrimaryColoursWin::Draw()
{
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
iGc->SetPenStyle(CGraphicsContext::ESolidPen);
iGc->SetPenColor(TRgb(255, 255, 255));
iGc->SetBrushColor(TRgb(0, 0, 0));
TSize winSize = Size();
iGc->DrawRect(TRect(winSize));
CFont* font;
TFontSpec fontSpec(_L(""), 300);
TheClient->iScreen->GetNearestFontInTwips(font, fontSpec);
if (font)
{
iGc->UseFont(font);
TRect r(TPoint(0, 0), Size());
r.Shrink(kMinHeight, kMinHeight);
iGc->DrawText(iDisplayText, r, font->AscentInPixels(), iGc->ECenter, 0);
iGc->DiscardFont();
TheClient->iScreen->ReleaseFont(font);
}
iNumColours = 0;
TPoint lhsAbs = Win()->AbsPosition();
for(TInt channelnum = 0, channelmul = 1, xoordinate = kPlotMargin; channelnum < KNumChannels; channelnum++, channelmul <<= 8, xoordinate += kPlotWithMargin)
{
TRgb lastPixel(255, 255, 255, 255);
for(TInt colour = 0; colour < KNumColours; colour++)
{
if(!iBadPixels[channelnum][colour])
{
iGc->SetPenColor(TRgb(colour * channelmul));
}
else
{
iGc->SetPenColor(TRgb(255, 255, 255));
}
TPoint point = TPoint(xoordinate + (colour & 0x0f), kPlotMargin + (colour >> 4));
iGc->Plot(point);
}
}
iDrawn=ETrue;
}