Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
How to Change CEikLabel Color in Symbian C++
This code snippet shows how to change the CEikLabel text and background colour.
S60 3rd Edition (initial release)
//Here iLabel is a class member of type CEikLabel*
iLabel= new (ELeave) CEikLabel;
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL( _L("Some Text") );
// Using blue as foreground color
iLabel->OverrideColorL( EColorLabelText, KRgbBlue );
// Set red as background color
iLabel->OverrideColorL(EColorControlBackground, KRgbRed )
S60 3rd Edition
As discussed in this discussion thread, EColorControlBackground doesn't work for setting the background on the S60 3rd Edition emulator. Instead you can use EColorLabelHighlightFullEmphasis as shown below:
iLabel->OverrideColorL( EColorLabelHighlightFullEmphasis, KRgbRed ); // red background
iLabel->OverrideColorL( EColorLabelTextEmphasis, KRgbBlue ); // and blue text