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/”);
}

 

版权声明:本文为pingg2019原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/pingg2019/p/10518319.html