用c++builder编写的闹钟程序
来源:互联网 发布:linux查看snmp状态 编辑:程序博客网 时间:2024/05/02 04:19
源代码如下
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
OpenDialog1->Execute();
MediaPlayer1->FileName=OpenDialog1->FileName;
MediaPlayer1->Open();
Button2->Enabled=true;
Button4->Enabled=true;
Label4->Visible=true;
//MediaPlayer1->Play();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int s,f,m;
s=StrToInt(InputBox("输入","请输入时间小时数",""));
f=StrToInt(InputBox("输入","请输入时间分数",""));
m=StrToInt(InputBox("输入","请输入时间秒数",""));
Canvas->TextOut(0,20,"所定的时间为:"+IntToStr(s)+":"+IntToStr(f)
+":"+IntToStr(m));
Edit1->Text =s;
Edit2->Text =f;
Edit3->Text =m;
// MediaPlayer1->Play();
Timer1->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Canvas->TextOut(0,0,"当前时间为:"+Time());
AnsiString a,e;
TTime b,c,d;
a=Edit1->Text+":" +Edit2->Text+":"+Edit3->Text;
b=StrToTime(a);
c=FormatDateTime("hh:mm:ss",Time());
d=b-c;
Canvas->TextOut(0,40,"剩余时间:"+d);
e=TimeToStr(d);
if(e=="0:00:00")
{ Timer1->Enabled=false;
MediaPlayer1->Play();
Button2->Caption="重新载入时间" ;}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
MediaPlayer1->Play();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer2Timer(TObject *Sender)
{
Canvas->TextOut(0,0,"当前时间为:"+Time());
}
//---------------------------------------------------------------------------
- 用c++builder编写的闹钟程序
- php编写的闹钟程序
- 用 C++Builder 编写 Tray 程序
- 【用C++Builder编写定时关机程序】
- 用C语言实现的闹钟程序
- 我用c++ builder做的闹钟
- [C++] BC++ Builder 如何编写用TCP/IP的通讯程序
- 用C++ Builder编写Tray程序
- 用 C++Builder 编写发送电子邮件软件
- 用C++Builder 6编写VCL控件
- 用C++Builder编写发送电子邮件软件
- 在C++Builder中编写发送图象文件程序(一)
- 在C++Builder中编写发送图象文件程序(二)
- 在C++Builder中编写发送图象文件程序(三)
- 在C++Builder中编写发送图象文件程序(四)
- 用python+wxpython写的闹钟程序
- 闹钟程序的设计
- linux c 模拟闹钟程序
- 进程与线程的区别 What is the difference between process and thread
- WebKit编译的几点看法
- theForm_EVENTTARGET 为空或不是对象
- Oracle架构的基础知识(入门级)
- LinuxQQ自动崩溃退出的解决
- 用c++builder编写的闹钟程序
- macro与inline的区别 What is the difference between macro and inline?
- 网上比较流行的一种tab切换效果代码,主要是用于导航的一些栏目。
- ASPX动态生成html(转)
- jQuery技巧
- 一个简单的手机蓝牙聊天程序的源码
- oracle正式环境备份恢复到测试环境的一个方便方案
- j2me图片缩放方法
- vmware中的ubuntu升级导致与xp共享的目录丢失