| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 587 人关注过本帖
标题:[分享]XP下的简易关闭模式
只看楼主 加入收藏
feeling
Rank: 4
来 自:福建厦门
等 级:贵宾
威 望:10
帖 子:105
专家分:0
注 册:2006-3-29
收藏
 问题点数:0 回复次数:0 
[分享]XP下的简易关闭模式

Public Class shutdownInWinXP
Inherits System.Windows.Forms.Form

#Region " ... "

Public Sub New()
MyBase.New()
'...
InitializeComponent()
End Sub
'...
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'...
Private components As System.ComponentModel.IContainer

'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton6 As System.Windows.Forms.RadioButton
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.RadioButton4 = New System.Windows.Forms.RadioButton
Me.RadioButton3 = New System.Windows.Forms.RadioButton
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.GroupBox3 = New System.Windows.Forms.GroupBox
Me.RadioButton6 = New System.Windows.Forms.RadioButton
Me.RadioButton5 = New System.Windows.Forms.RadioButton
Me.CheckBox1 = New System.Windows.Forms.CheckBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.GroupBox3.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.TextBox2)
Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Controls.Add(Me.GroupBox2)
Me.GroupBox1.Controls.Add(Me.RadioButton2)
Me.GroupBox1.Controls.Add(Me.RadioButton1)
Me.GroupBox1.Controls.Add(Me.GroupBox3)
Me.GroupBox1.Location = New System.Drawing.Point(24, 32)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(480, 272)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "关闭与重启系统"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(312, 184)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(160, 40)
Me.Label3.TabIndex = 7
Me.Label3.Text = "时间单位为:秒"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(312, 64)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(160, 40)
Me.Label2.TabIndex = 6
Me.Label2.Text = "时间单位为:秒"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(304, 224)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(168, 21)
Me.TextBox2.TabIndex = 5
Me.TextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(304, 104)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(176, 21)
Me.TextBox1.TabIndex = 4
Me.TextBox1.Text = ""
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.RadioButton4)
Me.GroupBox2.Controls.Add(Me.RadioButton3)
Me.GroupBox2.Location = New System.Drawing.Point(184, 32)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(120, 112)
Me.GroupBox2.TabIndex = 2
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "关闭动作"
'
'RadioButton4
'
Me.RadioButton4.Location = New System.Drawing.Point(16, 72)
Me.RadioButton4.Name = "RadioButton4"
Me.RadioButton4.Size = New System.Drawing.Size(96, 24)
Me.RadioButton4.TabIndex = 1
Me.RadioButton4.Text = "等待时间:"
'
'RadioButton3
'
Me.RadioButton3.Location = New System.Drawing.Point(16, 32)
Me.RadioButton3.Name = "RadioButton3"
Me.RadioButton3.Size = New System.Drawing.Size(96, 24)
Me.RadioButton3.TabIndex = 0
Me.RadioButton3.Text = "立即"
'
'RadioButton2
'
Me.RadioButton2.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.RadioButton2.Location = New System.Drawing.Point(8, 144)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(176, 40)
Me.RadioButton2.TabIndex = 1
Me.RadioButton2.Text = "重启xp操作系统"
'
'RadioButton1
'
Me.RadioButton1.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.RadioButton1.Location = New System.Drawing.Point(8, 32)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(176, 32)
Me.RadioButton1.TabIndex = 0
Me.RadioButton1.Text = "关闭xp操作系统"
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.RadioButton6)
Me.GroupBox3.Controls.Add(Me.RadioButton5)
Me.GroupBox3.Location = New System.Drawing.Point(184, 152)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(120, 112)
Me.GroupBox3.TabIndex = 3
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "重启动作"
'
'RadioButton6
'
Me.RadioButton6.Location = New System.Drawing.Point(16, 72)
Me.RadioButton6.Name = "RadioButton6"
Me.RadioButton6.Size = New System.Drawing.Size(96, 24)
Me.RadioButton6.TabIndex = 1
Me.RadioButton6.Text = "等待时间:"
'
'RadioButton5
'
Me.RadioButton5.Location = New System.Drawing.Point(16, 32)
Me.RadioButton5.Name = "RadioButton5"
Me.RadioButton5.Size = New System.Drawing.Size(96, 24)
Me.RadioButton5.TabIndex = 0
Me.RadioButton5.Text = "立即"
'
'CheckBox1
'
Me.CheckBox1.Font = New System.Drawing.Font("宋体", 21.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.CheckBox1.Location = New System.Drawing.Point(80, 312)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(384, 40)
Me.CheckBox1.TabIndex = 1
Me.CheckBox1.Text = "是否取消关闭或重启操作"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(96, 352)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 2
Me.Button1.Text = "&M确定"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(328, 352)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 3
Me.Button2.Text = "&E退出"
'
'Label1
'
Me.Label1.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.Label1.Location = New System.Drawing.Point(24, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(488, 23)
Me.Label1.TabIndex = 4
Me.Label1.Text = "注:本界面,只适合Windows XP"
'
'shutdownInWinXP
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.Color.Silver
Me.ClientSize = New System.Drawing.Size(528, 384)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.CheckBox1)
Me.Controls.Add(Me.GroupBox1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "shutdownInWinXP"
Me.Text = "shutdownInWinXP"
Me.TopMost = True
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox3.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub shutdownInWinXP_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Me.Show()
Me.TextBox1.Enabled = False
Me.TextBox2.Enabled = False
Me.RadioButton3.Enabled = False
Me.RadioButton4.Enabled = False
Me.RadioButton5.Enabled = False
Me.RadioButton6.Enabled = False
Catch ex As Exception
finalproducts_msg_system(ex.Message)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2.Click
Try
Me.Close()
Catch ex As Exception
finalproducts_msg_system(ex.Message)
End Try
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
If Me.RadioButton4.Checked = True Then
Me.TextBox1.Enabled = True
Me.TextBox1.Focus()
ElseIf Me.RadioButton4.Checked = False Then
Me.TextBox1.Text = ""
Me.TextBox1.Enabled = False
End If
End Sub
Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
If Me.RadioButton6.Checked = True Then
Me.TextBox2.Enabled = True
Me.TextBox2.Focus()
ElseIf Me.RadioButton6.Checked = False Then
Me.TextBox2.Text = ""
Me.TextBox2.Enabled = False
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If Me.RadioButton1.Checked = True Then
Me.RadioButton3.Enabled = True
Me.RadioButton4.Enabled = True
Me.RadioButton4.Checked = True
ElseIf Me.RadioButton1.Checked = False Then
Me.RadioButton3.Enabled = False
Me.RadioButton4.Enabled = False
Me.RadioButton4.Checked = False
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If Me.RadioButton2.Checked = True Then
Me.RadioButton5.Enabled = True
Me.RadioButton6.Enabled = True
Me.RadioButton6.Checked = True
ElseIf Me.RadioButton2.Checked = False Then
Me.RadioButton5.Enabled = False
Me.RadioButton6.Enabled = False
Me.RadioButton6.Checked = False
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.RadioButton1.Checked = True Then
If Me.RadioButton3.Checked = True Then
Try
Dim pro As New System.Diagnostics.Process
pro.Start("shutdown", " -s -t 0")
Catch ex As Exception
finalproducts_msg_system(ex.Message)
End Try
ElseIf Me.RadioButton4.Checked = True Then
Try
If IsNumeric(Me.TextBox1.Text) = True Then
Dim pro As New System.Diagnostics.Process
pro.Start("shutdown", " -s -t " & Trim(Me.TextBox1.Text))
Else
MessageBox.Show("单位必须为十进制----秒", "人事管理系统--提示信息!", MessageBoxButtons.OK)
Exit Sub
End If
Catch ex As Exception
finalproducts_msg_system(ex.Message)
End Try
End If
ElseIf Me.RadioButton2.Checked = True Then
If Me.RadioButton5.Checked = True Then
Try
Dim pro As New System.Diagnostics.Process
pro.Start("shutdown", " -r -t 0")
Catch ex As Exception
finalproducts_msg_system(ex.Message)
End Try
ElseIf Me.RadioButton6.Checked = True Then
Try
If IsNumeric(Me.TextBox2.Text) = True Then
Dim pro As New System.Diagnostics.Process
pro.Start("shutdown", " -r -t " & Trim(Me.TextBox2.Text))
Else
MessageBox.Show("单位必须为十进制----秒", "人事管理系统--提示信息!", MessageBoxButtons.OK)
Exit Sub
End If
Catch ex As Exception
finalproducts_msg_system(ex.Message)
End Try
End If
End If
If Me.CheckBox1.Checked = True Then
Me.RadioButton1.Checked = False
Me.RadioButton2.Checked = False
Try
Dim pro As New System.Diagnostics.Process
pro.Start("shutdown", " -a")
Catch ex As Exception
finalproducts_msg_system(ex.Message)
End Try
End If
End Sub
End Class

[此贴子已经被作者于2006-4-27 8:54:54编辑过]



F5WrDJ57.txt (15.46 KB) [分享]XP下的简易关闭模式

搜索更多相关主题的帖子: 模式 分享 
2006-04-27 08:45
快速回复:[分享]XP下的简易关闭模式
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.045563 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved