?? mycontrol.cpp
字號(hào):
#include "mycontrol.h"
#include <gdi.h>
#include <e32math.h>
const TRgb CMyControl::iColor[3] = {TRgb(255, 0, 0),TRgb(0, 255, 0), TRgb(0, 0, 255)};
CMyControl::CMyControl()
{
// No implementation required
}
CMyControl::~CMyControl()
{
}
CMyControl*
CMyControl::NewLC(TRect aRect)
{
CMyControl* self = new (ELeave) CMyControl();
CleanupStack::PushL(self);
self->ConstructL(aRect);
return self;
}
CMyControl*
CMyControl::NewL(TRect aRect)
{
CMyControl* self = CMyControl::NewLC(aRect);
CleanupStack::Pop(); // self;
return self;
}
void
CMyControl::ConstructL(TRect& aRect)
{
SetRect(aRect);
iColorIndex = Math::Random() % iMaxColorNum;
}
_LIT(KHello, "Hello world!");
void
CMyControl::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.SetBrushColor(iColor[iColorIndex]);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
}
void CMyControl::HandlePointerEventL(const TPointerEvent &aPointerEvent)
{
if(aPointerEvent.iType == TPointerEvent::EButton1Up)
{
iColorIndex = (iColorIndex + 1) % iMaxColorNum;
DrawDeferred();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -