设计一个如下图所示窗体:该窗体自动位于屏幕中央;大小不可调;最小化、最大化按钮不可用;窗体标题为“烟台大学”。在该窗体上,放置一个按钮、一个标签。单击按钮时,在标签上显示当前系统时间。

来源:互联网 发布:java web即时聊天插件 编辑:程序博客网 时间:2024/04/27 13:24
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;


namespace WindowsFormsApplication8
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;   
        }


        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = DateTime.Now.ToShortTimeString();
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            this.MinimizeBox = false;
            this.MaximizeBox = false;
            //this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;   
        }
    }
}