Symbian学习笔记14 之 在UI中显示CEikLabel和颜色设置

本文介绍了一个Symbian平台UI编程实例,演示如何使用CEikLabel组件并设置其颜色映射。通过覆盖颜色设置,可以改变UI控件的颜色方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 这个跟我们在新建HELLOWORLD的UI程序不一样,我们需要在Container中声明个CEikLabel *iLabel成员变量,并把它显示在UI中 。

CEikLabel没有SetColor来设置颜色,它是通过void OverrideColorL(TInt aLogicalColor,TRgb aColor);来设置颜色see:

OverrideColorL()

void OverrideColorL(TInt aLogicalColor,TRgb aColor);

Description

Overrides 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.

Parameters
TInt 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();
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值