This page was last modified 19:07, 24 June 2008.
Series 60 3rd上绘图时设置字体的大小
From Forum Nokia Wiki
通常我们在绘制文字时都是使用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上没有效果.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| series 80 and UIQ..??? | dakoz | General Symbian C++ | 1 | 2006-04-04 17:15 |
| My app cannot start on 3650 | ertra | Mobile Java General | 2 | 2003-07-19 16:25 |
| Pls help: Series 40 RMS | sarith | Mobile Java General | 3 | 2005-11-21 13:18 |
| how to wrap text on series 80 | rahulsingh | General Symbian C++ | 0 | 2005-12-05 10:04 |
| What is the best way to target multiple devices? | msdawy | Mobile Java Media (Graphics & Sounds) | 5 | 2004-03-23 16:04 |
