Namespaces
Variants
Actions

如何绘制自定义边框

Jump to: navigation, search
文章信息

文章
翻译:
hoolee
最后由 hamishwillee 在 16 Aug 2012 编辑

概述

这段代码演示了如何在一个GUI组件上绘制自定义边框。此代码通过自签名即可执行。

头文件

重载CCoeControl::Draw方法。.

// From CCoeControl
public:
// Draws the view.
void Draw(const TRect& aRect) const;


源文件

定义边框的颜色:

#define KBorderColor TRgb(180, 0, 0)

绘制将在CCoeControl::Draw完成,这样当view被绘制时边框也能显示了.

// Draws the view.
void CAppView::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
 
// Draw the border around the component (iComponent)
gc.SetBrushColor(KBorderColor);
TRect rect = iComponent->Rect();
// Enlarge the border rectangle so that it becomes visible. Without this,
// the rect would only contain the innards of the component, which will
// be obscured by the component itself.
rect.Grow(3, 3);
gc.DrawRect(rect);
}
This page was last modified on 16 August 2012, at 09:42.
403 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved