当前位置: 代码迷 >> Symbian >> lable控件字体样式。该怎么解决
  详细解决方案

lable控件字体样式。该怎么解决

热度:4916   发布时间:2013-02-26 00:00:00.0
lable控件字体样式。。
我用lable控件可以改字体的颜色,大小,
iUsernameLabel-> SetExtent(TPoint(40,170),TSize(40,30)/*iUsernameLabel-> MinimumSize()*/);
iUsernameLabel-> OverrideColorL(   EColorLabelText,   KRgbWhite   );//颜色
                 

                  iUsernameLabel-> SetFont(CEikonEnv::Static()-> DenseFont());//字体样式

用上面的这个是系统的字体,效果不明显啊。。。
。。。那位大虾知道还没有其他的方法。能让字体加粗和斜体的。。。效果显著的。

------解决方案--------------------------------------------------------
Hi,

S60 3rd Edition FP2 emulator测试通过:

const CFont* nf = iCoeEnv->NormalFont();
TFontSpec fontSpec = nf->FontSpecInTwips();
// you may also use the following API to get a font spec
// TFontSpec fontSpec = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL)->FontSpecInTwips();
// italic
fontSpec.iFontStyle.SetPosture(EPostureItalic);
// bold
// fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
CFont* font = NULL;
iCoeEnv->ScreenDevice()->GetNearestFontInTwips(font, fontSpec);
iLabel1->SetFont(font);

Regards

Ziteng Chen