Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Series 60 3rd上绘图时设置字体的大小

From Wiki
Jump to: navigation, search
Article Metadata

文章
beover1984 在 02 Aug 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

通常我们在绘制文字时都是使用CEikonEnv提供的NormalFont(),AnnotationFon(),TitleFont()等字体,有的情况需要调整字体的大小,下面的代码演示了如何设置字体大小的方法:

void  CEditorList3Col::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
 
gc.Clear( aRect );
 
CFont *font = NULL;
//获取字体的信息
TFontSpec fontSpec = iEikonEnv->LegendFont()->FontSpecInTwips();
fontSpec.iHeight -= fontSpec.iHeight / 6; //更改字体大小
//根据设置的字体信息获取合适的字体
iCoeEnv->ScreenDevice()->GetNearestFontInTwips( font, fontSpec );
gc.UseFont( font );
 
//Draw text operation
..................................
 
gc.DiscardFont();
//记住要调用ReleaseFont()释放字体资源.
iCoeEnv->ScreenDevice()->ReleaseFont( font );
}

说明: 由于Series60 3rd上与2nd上使用的字体形式可能不同,上面的代码可能在Series60 2nd上没有效果.

This page was last modified on 15 December 2011, at 10:13.
215 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×