分类: 嵌入式
2011-01-29 12:32:42
这个跟我们在新建HELLOWORLD的UI程序不一样,我们需要在Container中声明个CEikLabel *iLabel成员变量,并把它显示在UI中 。
CEikLabel没有SetColor来设置颜色,它是通过void OverrideColorL(TInt aLogicalColor,TRgb aColor);来设置颜色see:
void OverrideColorL(TInt aLogicalColor,TRgb aColor);
DescriptionOverrides the control's colour setting, as specified in the application's colour scheme.
This function does not change the application's colour scheme — it changes the colour mapping used in this control only.
ParametersTInt aLogicalColor |
The logical colour. Indicates which part of a control the physical colour maps to. The set of logical colours for a standard application are defined in TLogicalColor. |
TRgb aColor |
The new physical colour to which the logical colour should be mapped. |
void CFirstFuckContainer::ConstructL( const TRect &aRect )
{
CreateWindowL();
InitComponentArrayL();
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL(*this);
iLabel->SetRect( aRect ); //一定要加这句,这个用来指定控件所占的区域
iLabel->OverrideColorL( EColorLabelText, KRgbRed );//设置CEikLabel颜色
iLabel->SetEmphasis( CEikLabel::ENoEmphasis )
//iLabel->SetPosition(AKNEXQUERY_LABEL2_POSITION);
iLabel->SetAlignment( EHCenterVTop );
iLabel->SetTextL( _L("Billpig"));
//iLabel->DrawNow();
//Components().AppendLC( iLabel );
//CleanupStack::Pop( iLabel );
SetRect( aRect );
//SetBlank();
ActivateL();
}