C# 定时关机小程序

时间:2019-03-12 18:49:31   收藏:0   阅读:189

1.打开VS2019,创建界面和按钮

技术图片

2. 代码如下:

private void button1_Click(object sender, EventArgs e)
{
downpc(txttime.Text);
}

private static void downpc(string time)
{
Process.Start("shutdown", "/s /t "+time);

}

private void button2_Click(object sender, EventArgs e)
{
Process.Start("shutdown", "-a");
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.cnblogs.com/pingg2019/");
}

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!