苏飞论坛

标题: 用timer控件做的小闹钟 [打印本页]

作者: wuyf    时间: 2013-7-23 11:26
标题: 用timer控件做的小闹钟
用timer控件做的小闹钟  ,用的都是基础语法。
作者: 站长苏飞    时间: 2013-7-23 11:35
[code=csharp]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;

namespace alarm_clock
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Class1 c = new Class1();
            label1.Text =DateTime.Now.ToShortTimeString() ;
           
            if (label1.Text == textBox1.Text)
            {
                c.alarmclock();
                timer1.Enabled = false;
            }
            
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

      
    }
}
[/code]
看过,如果楼主能美化一下界面就更好了,可以做成一个闹钟的不规则图片,这样估计会好看一些
作者: wuyf    时间: 2013-7-23 11:39
谢谢飞哥指点,可是闹钟的不规则图片我不会做。飞哥能给个样板,我模仿做一下。或者给一个你平时在项目中做过的相关的也行。
作者: 站长苏飞    时间: 2013-7-23 11:47
这个上学时写过,不过代码肯定是早删除了,或者是不知道被遗弃到那里去了,其实思路很简单
把你的窗体设置居透明的,然后再设置成不显示标题的
然后把背景图片设置成一个闹钟的图片就行了,这个时候会有一个麻烦就是怎么操作无标题窗体的移动,不过这个问题你可以参考我的文章进行解决,可以自己试试http://www.sufeinet.com/thread-68-1-1.html





欢迎光临 苏飞论坛 (http://www.sufeinet.com/) Powered by Discuz! X3.4