设置CEikEdwin、CEikSecretEditor字体(转)
设置CEikEdwin、CEikSecretEditor字体
类归于: Symbian札记 — gio @ 1:37 下午
1、CEikEdwin类并没有SetFont()函数,可以通过以下的代码实现字体的设置
相关头文件:gdi.h, txtglobl.h
相关库文件:gdi.lib, etext.lib
代码:
const CFont* iEdwinFont = CEikonEnv::Static()->NormalFont();
CGlobalText* globalText = (CGlobalText*)iEdwin->Text();
TCharFormat charFormat;
Mem::FillZ(&charFormat, sizeof(TCharFormat));
TCharFormatMask charMask;
Mem::FillZ(&charMask, sizeof(TCharFormatMask));
TFontSpec sFontSpec = iEdwinFont->FontSpecInTwips();
charFormat.iFontSpec.iTypeface = sFontSpec.iTypeface;
charMask.SetAttrib(EAttFontTypeface);
charFormat.iFontSpec.iHeight = sFontSpec.iHeight;
charMask.SetAttrib(EAttFontHeight);
charFormat.iFontPresentation.iTextColor = KRgbBlack;
charMask.SetAttrib(EAttColor);
globalText->ApplyCharFormatL(charFormat,charMask,0,iEdwin->TextLength());
2、CEikSecretEditor密码框控件可以使用AknSetFont()函数来设置。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步