Dim Reg As Microsoft.Win32.RegistryKey
Private Sub InitVar()
If btnSave.Visible = True Then
End If
Reg = CurrentUser.OpenSubKey(\"Software\\Microsoft\\Windows\\CurrentVersion\\Run\", True)
If Reg.GetValue(\"MengXianHui\") <> \"\" Then
CheckBox1.Checked = True
Else
CheckBox1.Checked = False
End If
End Sub
Private Sub SaveSettings()
If CheckBox1.Checked = True Then
Reg = CurrentUser.OpenSubKey(\"Software\\Microsoft\\Windows\\CurrentVersion\\Run\", True)
Reg.SetValue(\"MengXianHui\", Application.ExecutablePath)
Else
Reg = CurrentUser.OpenSubKey(\"Software\\Microsoft\\Windows\\CurrentVersion\\Run\", True)
Reg.SetValue(\"MengXianHui\", \"\")
End If
InitVar()
MessageBox.Show(\"您已经设置了,请重新启动计算机看效果。\", \"提示\", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
If CheckBox1.Checked = True Then
Me.Dispose(True)
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles btnSave.Click
SaveSettings()
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
#Region \" Windows 窗体设计器生成的代码 \"
Public Sub New()
MyBase.New()
InitializeComponent()
\'在 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
\'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
\'注意:以下过程是 Windows 窗体设计器所必需的
\'可以使用 Windows 窗体设计器修改此过程。
\'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.Button3 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.SuspendLayout()
\'
\'Button1
\'
Me.Button1.Location = New System.Drawing.Point(365, 63)
Me.Button1.Name = \"Button1\"
Me.Button1.Size = New System.Drawing.Size(115, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = \"将图象保存成XML\"
\'
\'Button2
\'
Me.Button2.Location = New System.Drawing.Point(365, 98)