c#制作的定时关机重起小软件(需要dotnetfx.exe支持)

下载地址: /Files/kasafuma/TimeShutDown.rar
图象如下:

1.jpg 2.jpg
3.jpg

代码如下:
None.gif using  Microsoft.Win32;
None.gif
using  System.IO;
None.gif
using  System;
None.gif
using  System.Drawing;
None.gif
using  System.Collections;
None.gif
using  System.ComponentModel;
None.gif
using  System.Windows.Forms;
None.gif
using  System.Data;
None.gif
using  System.Runtime.InteropServices;
None.gif
using  System.Timers;
None.gif
namespace  WinShutDown
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// Form1 的摘要说明。
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class Form1 : System.Windows.Forms.Form
InBlock.gif        
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        [StructLayout(LayoutKind.Sequential, Pack
=1)]
InBlock.gif            
internal struct TokPriv1Luid
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
public int Count;
InBlock.gif            
public long Luid;
InBlock.gif            
public int Attr;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private System.ComponentModel.IContainer components;
InBlock.gif    
InBlock.gif        [DllImport(
"kernel32.dll", ExactSpelling=true) ]
InBlock.gif        
internal static extern IntPtr GetCurrentProcess();
InBlock.gif
InBlock.gif        [DllImport(
"advapi32.dll", ExactSpelling=true, SetLastError=true) ]
InBlock.gif        
internal static extern bool OpenProcessToken( IntPtr h, int acc, ref IntPtr phtok );
InBlock.gif
InBlock.gif        [DllImport(
"advapi32.dll", SetLastError=true) ]
InBlock.gif        
internal static extern bool LookupPrivilegeValue( string host, string name, ref long pluid );
InBlock.gif
InBlock.gif        [DllImport(
"advapi32.dll", ExactSpelling=true, SetLastError=true) ]
InBlock.gif        
internal static extern bool AdjustTokenPrivileges( IntPtr htok, bool disall,
InBlock.gif            
ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen );
InBlock.gif
InBlock.gif        [DllImport(
"user32.dll", ExactSpelling=true, SetLastError=true) ]
InBlock.gif        
internal static extern bool ExitWindowsEx( int flg, int rea );
InBlock.gif
InBlock.gif        
internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
InBlock.gif        
internal const int TOKEN_QUERY = 0x00000008;
InBlock.gif        
internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
InBlock.gif        
internal const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
InBlock.gif        
internal const int EWX_LOGOFF = 0x00000000;
InBlock.gif        
internal const int EWX_SHUTDOWN = 0x00000001;
InBlock.gif        
internal const int EWX_REBOOT = 0x00000002;
InBlock.gif        
internal const int EWX_FORCE = 0x00000004;
InBlock.gif        
internal const int EWX_POWEROFF = 0x00000008;
InBlock.gif        
internal const int EWX_FORCEIFHUNG = 0x00000010;
InBlock.gif        
private System.Windows.Forms.GroupBox groupBox1;
InBlock.gif        
private System.Windows.Forms.Timer timer1;
InBlock.gif        
private System.Windows.Forms.GroupBox groupBox2;
InBlock.gif        
private System.Windows.Forms.GroupBox groupBox3;
InBlock.gif        
private System.Windows.Forms.DateTimePicker dtpDay1;
InBlock.gif        
private System.Windows.Forms.DateTimePicker dtpTime1;
InBlock.gif        
private System.Windows.Forms.Button btnOK;
InBlock.gif        
private System.Windows.Forms.NotifyIcon notifyIcon1;
InBlock.gif        
private System.Windows.Forms.ContextMenu contextMenu1;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem1;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem2;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem3;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem4;
InBlock.gif        
private System.Windows.Forms.Button btnCancel;
InBlock.gif        
private DateTime shutdownTime=DateTime.Now;
InBlock.gif        
private System.Windows.Forms.RadioButton rb_shutdown;
InBlock.gif        
private System.Windows.Forms.RadioButton rb_reboot;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem5;
InBlock.gif        
private System.Windows.Forms.TextBox txtTime;
InBlock.gif        
public Form1()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// Windows 窗体设计器支持所必需的
InBlock.gif            
//
InBlock.gif
            InitializeComponent();
InBlock.gif
InBlock.gif            
//
InBlock.gif            
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
InBlock.gif            
//
ExpandedSubBlockEnd.gif
        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 清理所有正在使用的资源。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        protected override void Dispose( bool disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if( disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (components != null
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    components.Dispose();
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
base.Dispose( disposing );
ExpandedSubBlockEnd.gif        }

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
InBlock.gif        
/// 此方法的内容。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private void InitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.components = new System.ComponentModel.Container();
InBlock.gif            System.Resources.ResourceManager resources 
= new System.Resources.ResourceManager(typeof(Form1));
InBlock.gif            
this.txtTime = new System.Windows.Forms.TextBox();
InBlock.gif            
this.groupBox1 = new System.Windows.Forms.GroupBox();
InBlock.gif            
this.timer1 = new System.Windows.Forms.Timer(this.components);
InBlock.gif            
this.groupBox2 = new System.Windows.Forms.GroupBox();
InBlock.gif            
this.dtpTime1 = new System.Windows.Forms.DateTimePicker();
InBlock.gif            
this.dtpDay1 = new System.Windows.Forms.DateTimePicker();
InBlock.gif            
this.groupBox3 = new System.Windows.Forms.GroupBox();
InBlock.gif            
this.rb_reboot = new System.Windows.Forms.RadioButton();
InBlock.gif            
this.rb_shutdown = new System.Windows.Forms.RadioButton();
InBlock.gif            
this.btnOK = new System.Windows.Forms.Button();
InBlock.gif            
this.btnCancel = new System.Windows.Forms.Button();
InBlock.gif            
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
InBlock.gif            
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
InBlock.gif            
this.menuItem5 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.menuItem4 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.menuItem1 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.menuItem2 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.menuItem3 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.groupBox1.SuspendLayout();
InBlock.gif            
this.groupBox2.SuspendLayout();
InBlock.gif            
this.groupBox3.SuspendLayout();
InBlock.gif            
this.SuspendLayout();
InBlock.gif            
// 
InBlock.gif            
// txtTime
InBlock.gif            
// 
InBlock.gif
            this.txtTime.Location = new System.Drawing.Point(4816);
InBlock.gif            
this.txtTime.Name = "txtTime";
InBlock.gif            
this.txtTime.Size = new System.Drawing.Size(19221);
InBlock.gif            
this.txtTime.TabIndex = 0;
InBlock.gif            
this.txtTime.Text = "";
InBlock.gif            
// 
InBlock.gif            
// groupBox1
InBlock.gif            
// 
InBlock.gif
            this.groupBox1.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
InBlock.gif            
this.groupBox1.Controls.Add(this.txtTime);
InBlock.gif            
this.groupBox1.Location = new System.Drawing.Point(88);
InBlock.gif            
this.groupBox1.Name = "groupBox1";
InBlock.gif            
this.groupBox1.Size = new System.Drawing.Size(28048);
InBlock.gif            
this.groupBox1.TabIndex = 2;
InBlock.gif            
this.groupBox1.TabStop = false;
InBlock.gif            
this.groupBox1.Text = "当前系统时间";
InBlock.gif            
// 
InBlock.gif            
// timer1
InBlock.gif            
// 
InBlock.gif
            this.timer1.Enabled = true;
InBlock.gif            
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
InBlock.gif            
// 
InBlock.gif            
// groupBox2
InBlock.gif            
// 
InBlock.gif
            this.groupBox2.Controls.Add(this.dtpTime1);
InBlock.gif            
this.groupBox2.Controls.Add(this.dtpDay1);
InBlock.gif            
this.groupBox2.Location = new System.Drawing.Point(864);
InBlock.gif            
this.groupBox2.Name = "groupBox2";
InBlock.gif            
this.groupBox2.Size = new System.Drawing.Size(28048);
InBlock.gif            
this.groupBox2.TabIndex = 3;
InBlock.gif            
this.groupBox2.TabStop = false;
InBlock.gif            
this.groupBox2.Text = "设置时间";
InBlock.gif            
// 
InBlock.gif            
// dtpTime1
InBlock.gif            
// 
InBlock.gif
            this.dtpTime1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right;
InBlock.gif            
this.dtpTime1.Location = new System.Drawing.Point(14416);
InBlock.gif            
this.dtpTime1.Name = "dtpTime1";
InBlock.gif            
this.dtpTime1.ShowUpDown = true;
InBlock.gif            
this.dtpTime1.Size = new System.Drawing.Size(11221);
InBlock.gif            
this.dtpTime1.TabIndex = 1;
InBlock.gif            
this.dtpTime1.Value = new System.DateTime(200410140000);
InBlock.gif            
// 
InBlock.gif            
// dtpDay1
InBlock.gif            
// 
InBlock.gif
            this.dtpDay1.Location = new System.Drawing.Point(2416);
InBlock.gif            
this.dtpDay1.Name = "dtpDay1";
InBlock.gif            
this.dtpDay1.Size = new System.Drawing.Size(10421);
InBlock.gif            
this.dtpDay1.TabIndex = 0;
InBlock.gif            
// 
InBlock.gif            
// groupBox3
InBlock.gif            
// 
InBlock.gif
            this.groupBox3.Controls.Add(this.rb_reboot);
InBlock.gif            
this.groupBox3.Controls.Add(this.rb_shutdown);
InBlock.gif            
this.groupBox3.Location = new System.Drawing.Point(10128);
InBlock.gif            
this.groupBox3.Name = "groupBox3";
InBlock.gif            
this.groupBox3.Size = new System.Drawing.Size(27848);
InBlock.gif            
this.groupBox3.TabIndex = 4;
InBlock.gif            
this.groupBox3.TabStop = false;
InBlock.gif            
this.groupBox3.Text = "选择功能";
InBlock.gif            
// 
InBlock.gif            
// rb_reboot
InBlock.gif            
// 
InBlock.gif
            this.rb_reboot.Location = new System.Drawing.Point(12016);
InBlock.gif            
this.rb_reboot.Name = "rb_reboot";
InBlock.gif            
this.rb_reboot.TabIndex = 1;
InBlock.gif            
this.rb_reboot.Text = "重新启动";
InBlock.gif            
this.rb_reboot.CheckedChanged += new System.EventHandler(this.rb_reboot_CheckedChanged);
InBlock.gif            
// 
InBlock.gif            
// rb_shutdown
InBlock.gif            
// 
InBlock.gif
            this.rb_shutdown.Checked = true;
InBlock.gif            
this.rb_shutdown.Location = new System.Drawing.Point(2416);
InBlock.gif            
this.rb_shutdown.Name = "rb_shutdown";
InBlock.gif            
this.rb_shutdown.Size = new System.Drawing.Size(5624);
InBlock.gif            
this.rb_shutdown.TabIndex = 0;
InBlock.gif            
this.rb_shutdown.TabStop = true;
InBlock.gif            
this.rb_shutdown.Text = "关机";
InBlock.gif            
this.rb_shutdown.CheckedChanged += new System.EventHandler(this.rb_shutdown_CheckedChanged);
InBlock.gif            
// 
InBlock.gif            
// btnOK
InBlock.gif            
// 
InBlock.gif
            this.btnOK.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
InBlock.gif            
this.btnOK.Location = new System.Drawing.Point(56192);
InBlock.gif            
this.btnOK.Name = "btnOK";
InBlock.gif            
this.btnOK.Size = new System.Drawing.Size(7224);
InBlock.gif            
this.btnOK.TabIndex = 6;
InBlock.gif            
this.btnOK.Text = "开始";
InBlock.gif            
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
InBlock.gif            
// 
InBlock.gif            
// btnCancel
InBlock.gif            
// 
InBlock.gif
            this.btnCancel.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
InBlock.gif            
this.btnCancel.Location = new System.Drawing.Point(168192);
InBlock.gif            
this.btnCancel.Name = "btnCancel";
InBlock.gif            
this.btnCancel.Size = new System.Drawing.Size(7524);
InBlock.gif            
this.btnCancel.TabIndex = 7;
InBlock.gif            
this.btnCancel.Text = "退出";
InBlock.gif            
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
InBlock.gif            
// 
InBlock.gif            
// notifyIcon1
InBlock.gif            
// 
InBlock.gif
            this.notifyIcon1.ContextMenu = this.contextMenu1;
InBlock.gif            
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
InBlock.gif            
this.notifyIcon1.Text = "";
InBlock.gif            
this.notifyIcon1.Visible = true;
InBlock.gif            
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
InBlock.gif            
// 
InBlock.gif            
// contextMenu1
InBlock.gif            
// 
ExpandedSubBlockStart.gifContractedSubBlock.gif
            this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] dot.gif{
InBlock.gif                                                                                         
this.menuItem5,
InBlock.gif                                                                                         
this.menuItem4,
InBlock.gif                                                                                         
this.menuItem1,
InBlock.gif                                                                                         
this.menuItem2,
ExpandedSubBlockEnd.gif                                                                                         
this.menuItem3}
);
InBlock.gif            
// 
InBlock.gif            
// menuItem5
InBlock.gif            
// 
InBlock.gif
            this.menuItem5.Index = 0;
InBlock.gif            
this.menuItem5.Text = "重启";
InBlock.gif            
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
InBlock.gif            
// 
InBlock.gif            
// menuItem4
InBlock.gif            
// 
InBlock.gif
            this.menuItem4.Index = 1;
InBlock.gif            
this.menuItem4.Text = "关机";
InBlock.gif            
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
InBlock.gif            
// 
InBlock.gif            
// menuItem1
InBlock.gif            
// 
InBlock.gif
            this.menuItem1.Index = 2;
InBlock.gif            
this.menuItem1.Text = "退出";
InBlock.gif            
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
InBlock.gif            
// 
InBlock.gif            
// menuItem2
InBlock.gif            
// 
InBlock.gif
            this.menuItem2.Index = 3;
InBlock.gif            
this.menuItem2.Text = "隐藏";
InBlock.gif            
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
InBlock.gif            
// 
InBlock.gif            
// menuItem3
InBlock.gif            
// 
InBlock.gif
            this.menuItem3.Index = 4;
InBlock.gif            
this.menuItem3.Text = "关于";
InBlock.gif            
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
InBlock.gif            
// 
InBlock.gif            
// Form1
InBlock.gif            
// 
InBlock.gif
            this.AutoScaleBaseSize = new System.Drawing.Size(614);
InBlock.gif            
this.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
InBlock.gif            
this.ClientSize = new System.Drawing.Size(294252);
InBlock.gif            
this.Controls.Add(this.btnCancel);
InBlock.gif            
this.Controls.Add(this.btnOK);
InBlock.gif            
this.Controls.Add(this.groupBox3);
InBlock.gif            
this.Controls.Add(this.groupBox2);
InBlock.gif            
this.Controls.Add(this.groupBox1);
InBlock.gif            
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
InBlock.gif            
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
InBlock.gif            
this.MaximizeBox = false;
InBlock.gif            
this.MinimizeBox = false;
InBlock.gif            
this.Name = "Form1";
InBlock.gif            
this.ShowInTaskbar = false;
InBlock.gif            
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
InBlock.gif            
this.Text = "定时关机重起v1.0";
InBlock.gif            
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
InBlock.gif            
this.Load += new System.EventHandler(this.Form1_Load);
InBlock.gif            
this.groupBox1.ResumeLayout(false);
InBlock.gif            
this.groupBox2.ResumeLayout(false);
InBlock.gif            
this.groupBox3.ResumeLayout(false);
InBlock.gif            
this.ResumeLayout(false);
InBlock.gif
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif    
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 应用程序的主入口点。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [STAThread]
InBlock.gif        
static void Main() 
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            Application.Run(
new Form1());
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private static void DoExitWin(int flg)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
bool ok;
InBlock.gif            TokPriv1Luid tp;
InBlock.gif            IntPtr hproc 
= GetCurrentProcess();
InBlock.gif            IntPtr htok 
= IntPtr.Zero;
InBlock.gif            ok 
= OpenProcessToken( hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok );
InBlock.gif            tp.Count 
= 1;
InBlock.gif            tp.Luid 
= 0;
InBlock.gif            tp.Attr 
= SE_PRIVILEGE_ENABLED;
InBlock.gif            ok 
= LookupPrivilegeValue( null, SE_SHUTDOWN_NAME, ref tp.Luid );
InBlock.gif            ok 
= AdjustTokenPrivileges( htok, falseref tp, 0, IntPtr.Zero, IntPtr.Zero );
InBlock.gif            ok 
= ExitWindowsEx( flg, 0 );
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
InBlock.gif        
private void Form1_Load(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif       
dot.gif
InBlock.gif            
this.notifyIcon1.Visible=true;
InBlock.gif            
InBlock.gif            DateTime shutdownTime
=DateTime.Now;                                    
InBlock.gif
InBlock.gif            txtTime.Text
=System.DateTime.Now.ToString();            
InBlock.gif            dtpDay1.Format 
= DateTimePickerFormat.Custom;
InBlock.gif            dtpDay1.CustomFormat 
= "yyyy-MM-d";
InBlock.gif            dtpTime1.Format 
= DateTimePickerFormat.Custom;
InBlock.gif            dtpTime1.CustomFormat 
= "HH:mm:ss";            
InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void timer1_Tick(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{    
InBlock.gif         txtTime.Text
=System.DateTime.Now.ToString();            
InBlock.gif         
string     CurrDate=System.DateTime.Today.ToShortDateString() ; 
InBlock.gif         
string    CurrTime=System.DateTime.Now.ToLongTimeString();
InBlock.gif            
InBlock.gif            
if(CurrDate==dtpDay1.Value.ToShortDateString() && CurrTime==dtpTime1.Value.ToLongTimeString())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(rb_reboot.Checked==true)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    DoExitWin(EWX_REBOOT);
InBlock.gif                    Application.Exit();
InBlock.gif
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    DoExitWin(EWX_SHUTDOWN);
InBlock.gif                    Application.Exit();
ExpandedSubBlockEnd.gif                }

InBlock.gif                
ExpandedSubBlockEnd.gif            }

InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void btnOK_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Visible=false;
InBlock.gif            
this.notifyIcon1.Visible=true;    
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void menuItem1_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            notifyIcon1.Visible
=false;
InBlock.gif            
this.Close();
InBlock.gif            Application.Exit();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Visible=true;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{    
InBlock.gif            e.Cancel
=true;
InBlock.gif            
this.Visible=false;
InBlock.gif            
this.notifyIcon1.Visible=true;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void menuItem2_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Visible=false;
InBlock.gif            notifyIcon1.Visible
=false;
InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void btnCancel_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            notifyIcon1.Visible
=false;
InBlock.gif            
this.Close();
InBlock.gif            Application.Exit();
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void menuItem3_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            Form2 frm2
=new Form2();
InBlock.gif            frm2.Show();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void menuItem4_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            DoExitWin(EWX_POWEROFF);
InBlock.gif            Application.Exit();
InBlock.gif        
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void menuItem5_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            DoExitWin(EWX_REBOOT);
InBlock.gif            Application.Exit();
InBlock.gif        
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
bool isNumberic(string s)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
int.Parse(s);
InBlock.gif                
return true;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return false;
InBlock.gif
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void rb_reboot_CheckedChanged(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if(rb_reboot.Checked==true)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                rb_shutdown.Checked
=false;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                rb_shutdown.Checked
=true;
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif        
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void rb_shutdown_CheckedChanged(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if(rb_shutdown.Checked==true)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                rb_reboot.Checked
=false;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                rb_reboot.Checked
=true;
ExpandedSubBlockEnd.gif            }

InBlock.gif        
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

转载于:https://www.cnblogs.com/kasafuma/archive/2005/12/20/300557.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值