📄 digclockctrl.cpp__.htm
字号:
<html><head><title>Exercise_GUIClock.rar DigClockCtrl.cpp</title>
<LINK href="/inc/read_style.css" type=text/css rel=stylesheet></head>
<body>
<p><a href=http://www.pudn.com>www.pudn.com</a> > <a href="http://www.pudn.com/downloads91/sourcecode/comm/symbian/detail348522.html">Exercise_GUIClock.rar</a> > DigClockCtrl.cpp</p><!-- saved from http://www.pudn.com -->
<script src="/inc/gg_read1.js"></script><BR>
<pre name="code" class="cpp">
// DigClockCtrl.cpp: implementation of the CDigClockCtrl class.
//
//////////////////////////////////////////////////////////////////////
#include <coemain.h>
#include "DigClockCtrl.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDigClockCtrl::CDigClockCtrl()
{
}
CDigClockCtrl::~CDigClockCtrl()
{
}
void CDigClockCtrl::ConstructL()
{
}
void CDigClockCtrl::Draw(const TRect& /*aRect*/) const
{
// Window graphics context
CWindowGc& gc = SystemGc();
// Area in which we shall draw
TRect drawRect = Rect();
// Font used for drawing text
// Start with a clear screen
gc.Clear(drawRect);
// gc.DrawRect(drawRect);
// Draw an outline rectangle (the default pen
// and brush styles ensure this) slightly
// smaller than the drawing area.
this->DrawClock(gc,drawRect,iTime.Hour(),iTime.Minute(),iTime.Second());
}
void CDigClockCtrl::DrawClock(CWindowGc& aGc,const TRect & aRect,TInt aHour/*<=12*/,TInt aMin,TInt aSec) const
{
// Format the time into a descriptor, and handle any errors
TBuf<32> timeAsText;
_LIT (KTimeFormat, "%d: %d : %d");
timeAsText.Format(KTimeFormat,aHour,aMin,aSec);
// Write the time to the display
if(iSelected)
aGc.SetPenColor(TRgb(255,0,0));
else
aGc.SetPenColor(TRgb(0,0,0));
const CFont* fontUsed = iCoeEnv->NormalFont();
aGc.UseFont(fontUsed);
// Draw the text in the middle of the rectangle.
TInt baselineOffset=(aRect.Height() - fontUsed->HeightInPixels())/2;
aGc.DrawText(timeAsText,aRect,baselineOffset,CGraphicsContext::ECenter, 0);
// Finished using the font
aGc.DiscardFont();
}
</pre>
<script src="/inc/gg_read2.js"></script><BR>
<script src="http://s117.cnzz.com/stat.php?id=1236358&web_id=1236358&show=pic" language="JavaScript" charset="gb2312"></script>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -