Symbian设置CEikEdwin字体
2009-12-15 15:21
295 查看
Symbian设置CEikEdwin字体
先说第一种,它只适用于2nd
TCharFormat charFormat;
Mem::FillZ(&charFormat, sizeof (TCharFormat));
TCharFormatMask charMask;
Mem::FillZ(&charMask, sizeof (TCharFormatMask));
TFontSpec sFontSpec = PocoUtils::NormalFont()->FontSpecInTwips();
charFormat.iFontSpec.iTypeface = sFontSpec.iTypeface;
charMask.SetAttrib(EAttFontTypeface);
charFormat.iFontSpec.iHeight = sFontSpec.iHeight;
charMask.SetAttrib(EAttFontHeight);
charFormat.iFontPresentation.iTextColor = KDarkGreenColour;
charMask.SetAttrib(EAttColor);
charFormat.iFontPresentation.iStrikethrough = (TFontStrikethrough)EFalse;
charMask.SetAttrib(EAttFontStrikethrough);
charFormat.iFontPresentation.iUnderline = (TFontUnderline)EFalse;
charMask.SetAttrib(EAttFontUnderline);
CCharFormatLayer* FormatLayer1 = CCharFormatLayer::NewL(charFormat,charMask);
iTitle->SetCharFormatLayer(FormatLayer1);
再来介绍第二种,它使用于2nd和3rd
CFont* font=NULL;
#ifdef _UIQ3_SDK_
TFontSpec fontSpec=CEikonEnv::Static()->NormalFont()->FontSpecInTwips();
fontSpec.iHeight-=fontSpec.iHeight/4;
fontSpec.iFontStyle.SetPosture(EPostureUpright);
CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(font,fontSpec);
#else
font=CEikonEnv::Static()->NormalFont();
#endif
CGlobalText* globalText = (CGlobalText*)edwin->Text();
TCharFormat charFormat;
Mem::FillZ(&charFormat, sizeof (TCharFormat));
TCharFormatMask charMask;
Mem::FillZ(&charMask, sizeof (TCharFormatMask));
TFontSpec sFontSpec = font->FontSpecInTwips();
charFormat.iFontSpec.iTypeface = sFontSpec.iTypeface;
charMask.SetAttrib(EAttFontTypeface);
charFormat.iFontSpec.iHeight = sFontSpec.iHeight;
charMask.SetAttrib(EAttFontHeight);
charFormat.iFontPresentation.iTextColor = KDarkGreenColour;
charMask.SetAttrib(EAttColor);
globalText->ApplyCharFormatL(charFormat,charMask,0,edwin->TextLength());
ZT:http://hi.baidu.com/peng1987629/blog/item/a2271d1b59bd01f3ae51331a.html
先说第一种,它只适用于2nd
TCharFormat charFormat;
Mem::FillZ(&charFormat, sizeof (TCharFormat));
TCharFormatMask charMask;
Mem::FillZ(&charMask, sizeof (TCharFormatMask));
TFontSpec sFontSpec = PocoUtils::NormalFont()->FontSpecInTwips();
charFormat.iFontSpec.iTypeface = sFontSpec.iTypeface;
charMask.SetAttrib(EAttFontTypeface);
charFormat.iFontSpec.iHeight = sFontSpec.iHeight;
charMask.SetAttrib(EAttFontHeight);
charFormat.iFontPresentation.iTextColor = KDarkGreenColour;
charMask.SetAttrib(EAttColor);
charFormat.iFontPresentation.iStrikethrough = (TFontStrikethrough)EFalse;
charMask.SetAttrib(EAttFontStrikethrough);
charFormat.iFontPresentation.iUnderline = (TFontUnderline)EFalse;
charMask.SetAttrib(EAttFontUnderline);
CCharFormatLayer* FormatLayer1 = CCharFormatLayer::NewL(charFormat,charMask);
iTitle->SetCharFormatLayer(FormatLayer1);
再来介绍第二种,它使用于2nd和3rd
CFont* font=NULL;
#ifdef _UIQ3_SDK_
TFontSpec fontSpec=CEikonEnv::Static()->NormalFont()->FontSpecInTwips();
fontSpec.iHeight-=fontSpec.iHeight/4;
fontSpec.iFontStyle.SetPosture(EPostureUpright);
CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(font,fontSpec);
#else
font=CEikonEnv::Static()->NormalFont();
#endif
CGlobalText* globalText = (CGlobalText*)edwin->Text();
TCharFormat charFormat;
Mem::FillZ(&charFormat, sizeof (TCharFormat));
TCharFormatMask charMask;
Mem::FillZ(&charMask, sizeof (TCharFormatMask));
TFontSpec sFontSpec = font->FontSpecInTwips();
charFormat.iFontSpec.iTypeface = sFontSpec.iTypeface;
charMask.SetAttrib(EAttFontTypeface);
charFormat.iFontSpec.iHeight = sFontSpec.iHeight;
charMask.SetAttrib(EAttFontHeight);
charFormat.iFontPresentation.iTextColor = KDarkGreenColour;
charMask.SetAttrib(EAttColor);
globalText->ApplyCharFormatL(charFormat,charMask,0,edwin->TextLength());
ZT:http://hi.baidu.com/peng1987629/blog/item/a2271d1b59bd01f3ae51331a.html
相关文章推荐
- Symbian设置CEikEdwin字体
- Symbian设置CEikEdwin字体
- 设置CEikEdwin、CEikSecretEditor字体(转)
- C# winfrom设置textbox字体大小和样式
- Symbian中设置屏幕字体大小以及样式
- C# winfrom设置textbox字体大小和样式并结合GridView使用
- symbian 强制打开CEikEdwin关联的虚拟键盘
- 群里关于 CEikEdwin 的输入中文的讨论(symbian )
- symbian DrawText时需要注意,设置字体
- Symbian CEikEdwin 输入框使用总结
- CEikEdwin 与 CPAlbImageViewerBasic 在Symbian 2nd上的奇怪现象
- CEikEdwin 如何设置输入文本的颜色?
- win 7DOS命令窗口恢复默认设置,滚动条消失,字体颜色修改后还原。
- Google Chrome默认字体设置(Win)
- Symbian CEikEdwin 输入框使用总结
- 【转载】C# winfrom设置textbox字体大小和样式
- symbian CEikEdwin文字显示 汇总(转帖并增加)
- symbian Series 60 3rd上绘图时设置字体的大小
- 改变CEikEdwin字体大小的两种方法
- 设置CEikEdwin,只能输入数字