CEikLabel的基本功能是在控件中显示静态文本,而且是支持双向显示文字的,如果应用语言是从右到左的风格,那么文字将会是右对齐的。 CEikLabel 没有提供 SetColor() 方法,但你千万不要以为那就没有办法修改CEikLabel 的颜色了。你需要通过 OverrideColorL() 进行设置,并用 SetEmphasis()启动设定,从而跳过标签的EColorLabelTextEmphasis设置。 Following is the sample Code: #include ... // construct CEikLabel CEikLabel* myLabel; myLabel= new (ELeave) CEikLabel; myLabel->SetContainerWindowL( *this ); myLabel->SetTextL( _L("NewLC rulez!") ); // Set the foreground color is red myLabel->OverrideColorL( EColorLabelTextEmphasis, KRgbRed ); myLabel->SetEmphasis( CEikLabel::EPartialEmphasis ); 如果需要同时设置前景色和背景色,那么在这情况下,你还是需要跳过然后启动EColorLabelHighlightFullEmphasis的设置: // Set the foreground color is right // Set the background color is red myLabel->OverrideColorL( EColorLabelTextEmphasis, KRgbWhite ); myLabel->OverrideColorL( EColorLabelHighlightFullEmphasis, KRgbRed ); myLabel->SetEmphasis( CEikLabel::EFullEmphasis ); PS: The following functionality can be used by the application developer: Change the text string, Change the font that Label uses to display text, Toggle between no emphasis, partial emphasis and full emphasis, Change the number of pixels between the lines, Toggle between using underlined text or not, Toggle between using strikethrough text or not, Toggle between wrapping the text or not, Set the width to be used when wrapping text, Set the number of lines to display. By default, the following configuration applies: Normal system font is used, Text properties are no emphasis, not underlining and not strikethrough, Default system spacing between lines is used, Default system word wrapping settings is used, The control does not gain focus.
如何改变CEikLabel的颜色
最新推荐文章于 2025-09-14 15:41:56 发布
本文介绍如何使用CEikLabel控件显示静态文本,并提供了修改文本颜色的方法,包括前景色和背景色的设置。此外,还介绍了如何改变字体、强调方式等。

182

被折叠的 条评论
为什么被折叠?



