我想在界面上显示当前的时间 而且每一秒的变化也要显示出来 举个格式例子: PM: 14:50:31
界面显示上 字体应该是黑色的 背景是灰色的 而且要去掉时间旁边的那个下拉列表的箭头 要干净一点 只要显示时间..
请问实现这个功能需要用什么控件啊 该怎么设置 求大侠帮忙 小弟感激不尽!!
界面显示上 字体应该是黑色的 背景是灰色的 而且要去掉时间旁边的那个下拉列表的箭头 要干净一点 只要显示时间..
请问实现这个功能需要用什么控件啊 该怎么设置 求大侠帮忙 小弟感激不尽!!
调试欢乐多
using System.Drawing;
using System.Windows.Forms;class Form1 : Form
{
Form1()
{
Timer t = new Timer();
t.Tick += delegate{ Refresh(); };
t.Interval = 1000;
t.Start();
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawString(DateTime.Now.ToString("tt: HH:mm:ss"), new Font("Arial", 30), new SolidBrush(Color.Black), 10, 100);
}
static void Main()
{
Application.Run(new Form1());
}
}
using System.Drawing;
using System.Windows.Forms;class Form1 : Form
{
Form1()
{
Graphics g = CreateGraphics();
Timer t = new Timer();
t.Tick += delegate
{
g.Clear(BackColor);
g.DrawString(DateTime.Now.ToString("tt: HH:mm:ss"), new Font("Arial", 30), new SolidBrush(Color.Black), 10, 100);
};
t.Interval = 1000;
t.Start();
}
static void Main()
{
Application.Run(new Form1());
}
}