本文主要是介绍C#系统注销功能,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Forms;
- namespace Cancel
- {
- static class Program
- {
- /// <summary>
- /// 应用程序的主入口点。
- /// </summary>
- [STAThread]
- static void Main(string[] strArg)
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1(strArg));
- }
- }
- }
- 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.Diagnostics;
- namespace Cancel
- {
- public partial class Form1 : Form
- {
- string[] strargs;
- public Form1(string[] strarg)
- {
- InitializeComponent();
- strargs = strarg;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- // MessageBox.Show();
- Process sprs = new Process();
- sprs.StartInfo.FileName = Application.ExecutablePath.Trim();
- sprs.StartInfo.Arguments = "注销回来的";
- sprs.Start();
- Process.GetCurrentProcess().Kill();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- MessageBox.Show(strargs[0]);
- }
- }
- }
---------------方法二
//点击注销按钮事件里面写:
if
(MessageBox.Show(
"您确定要注销登录吗?"
,
"提示"
, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Application.Exit();
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
这篇关于C#系统注销功能的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!