WEB开发网
开发学院手机开发Symbian 开发 Symbian 开发技巧总结100条 阅读

Symbian 开发技巧总结100条

 2010-03-15 15:52:00 来源:WEB开发网   
核心提示:aBuf->Write(6,KFolks);Compress() //压缩控件为最小36. 改变控件风格: 1. 继承控件,重载GetTextDrawer 2. 在父控件或视图中:void CHelloWorldView::GetTextDrawer(CCoeTextDrawerBase*& aTextDrawe

aBuf->Write(6,KFolks);

Compress() //压缩控件为最小

36. 改变控件风格: 1. 继承控件,重载GetTextDrawer 2. 在父控件或视图中:

void CHelloWorldView::GetTextDrawer(CCoeTextDrawerBase*& aTextDrawer, const CCoeControl* aDrawingControl) const

{

if(aDrawingControl==iLabel)

{

aTextDrawer->SetTextColor(KRgbRed); //将字体设为红色

}

}

void CMyLabel::GetTextDrawer(CCoeTextDrawerBase*& aTextDrawer, const CCoeControl*/* aDrawingControl*/, TInt/* aKey*/) const

{ aTextDrawer->SetTextColor(KRgbRed); }

37. 改变title图标:

1. 获得Titlebar控件:

MQikViewContext* mvc = ViewContext();

CCoeControl* vc = &(mvc->AsControl());

CCoeControl* titlebar = vc->Parent()->Parent()->Parent();

2. 改变图标控件内容:

if(titlebar!=NULL)

{

CEikImage* titlebaricon = static_cast(titlebar->ComponentControl(0));

titlebaricon->SetContentL(KAnim);

// bug: the anim is always lower than expected,

}

无bug版见:"Symbian积累"

38. 使用计时器(-):

iPeriodic = CPeriodic::NewL(0); // neutral priority

iPeriodic->Start(KTickInterval,KTickInterval,TCallBack(Tick, this)); // Tick可以为成员方法

TInt CHelloWorldView::Tick(TAny* aObject){ aObject->DoTick(); } // 计时器响应

if(iPeriodic->IsActive())

{

iPeriodic->Cancel(); //取消

}

39. 抓屏:(抓屏.txt)

40. 在非对话框的系统块中添加CEikEdwin控件不会自动弹出:

CQikBuildingBlock* block = CQikBuildingBlock::CreateSystemBuildingBlockL(EQikCtCaptionedTwolineBuildingBlock);

container->AddControlLC(block, 100);

block->ConstructL();

_LIT(KCaption,"Title above second edwin");

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Symbian 开发 技巧

编辑录入:coldstar [复制链接] [打 印]
赞助商链接