65.9K
CodeProject 正在变化。 阅读更多。
Home

数字时钟和计时器 ActiveX 控件

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.43/5 (15投票s)

2002年2月4日

viewsIcon

198568

downloadIcon

10316

这是一个 ActiveX 控制,可以用作数字时钟,或用作计时器。

Sample Image - DTimer.gif

引言

这是一个用 Visual C++ 6.0 开发的 ActiveX 控制。它可以作为数字时钟或计时器使用。要使用它,只需将其添加到您的项目中,将其放在窗体上,并使用“类向导”将其与类成员关联。您可以使用以下方法对其进行自定义:

  • void CDTimer::SetColors(OLE_COLOR back, OLE_COLOR line, OLE_COLOR text)

    用于设置颜色外观。

  • void CDTimer::SetMode(short mode)

    用于将其设置为时钟或计时器。

  • void CDTimer::SetTime(short hou, short min, short sec)

    用于显示特定时间。

示例

m_timer.SetColors(RGB(0,0,0),RGB(0,0,0),RGB(255,0,0));
//display red numbers on black background

m_timer.SetMode(0);
// 0 for digital clock, 1 for custom timer.

m_timer.SetTimer(20,8,45);
//set the time to 20:08:45

将其设置为自定义计时器时,必须启动一个计时器,通过调用 SetTime 成员函数来更新时间。

© . All rights reserved.