⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.vb

📁 Visual.Basic.NET实用编程百例-47.6M.zip
💻 VB
字号:
Friend Class Form1
    Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
    Public Sub New()
        MyBase.New()
        '此调用是 Windows 窗体设计器所必需的。
        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 窗体设计器所必需的
    Public ToolTip1 As System.Windows.Forms.ToolTip
    Public WithEvents _cmdcontrol_3 As System.Windows.Forms.Button
    Public WithEvents _cmdcontrol_2 As System.Windows.Forms.Button
    Public WithEvents _cmdcontrol_1 As System.Windows.Forms.Button
    Public WithEvents _cmdcontrol_0 As System.Windows.Forms.Button
    Public WithEvents cmdcontrol As Microsoft.VisualBasic.Compatibility.VB6.ButtonArray
    '注意:以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器来修改它。
    '不要使用代码编辑器来修改它。
    Public WithEvents _cmdcontrol_5 As System.Windows.Forms.Button
    Public WithEvents _cmdcontrol_4 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me._cmdcontrol_5 = New System.Windows.Forms.Button
        Me._cmdcontrol_4 = New System.Windows.Forms.Button
        Me._cmdcontrol_3 = New System.Windows.Forms.Button
        Me._cmdcontrol_2 = New System.Windows.Forms.Button
        Me._cmdcontrol_1 = New System.Windows.Forms.Button
        Me._cmdcontrol_0 = New System.Windows.Forms.Button
        Me.cmdcontrol = New Microsoft.VisualBasic.Compatibility.VB6.ButtonArray(Me.components)
        CType(Me.cmdcontrol, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        '_cmdcontrol_5
        '
        Me._cmdcontrol_5.BackColor = System.Drawing.SystemColors.Control
        Me._cmdcontrol_5.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdcontrol.SetIndex(Me._cmdcontrol_5, CType(6, Short))
        Me._cmdcontrol_5.Location = New System.Drawing.Point(64, 216)
        Me._cmdcontrol_5.Name = "_cmdcontrol_5"
        Me._cmdcontrol_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdcontrol_5.Size = New System.Drawing.Size(150, 30)
        Me._cmdcontrol_5.TabIndex = 6
        Me._cmdcontrol_5.Text = "Internet"
        Me._cmdcontrol_5.TextAlign = System.Drawing.ContentAlignment.BottomCenter
        '
        '_cmdcontrol_4
        '
        Me._cmdcontrol_4.BackColor = System.Drawing.SystemColors.Control
        Me._cmdcontrol_4.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdcontrol.SetIndex(Me._cmdcontrol_4, CType(5, Short))
        Me._cmdcontrol_4.Location = New System.Drawing.Point(64, 168)
        Me._cmdcontrol_4.Name = "_cmdcontrol_4"
        Me._cmdcontrol_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdcontrol_4.Size = New System.Drawing.Size(150, 30)
        Me._cmdcontrol_4.TabIndex = 5
        Me._cmdcontrol_4.Text = "电源管理"
        Me._cmdcontrol_4.TextAlign = System.Drawing.ContentAlignment.BottomCenter
        '
        '_cmdcontrol_3
        '
        Me._cmdcontrol_3.BackColor = System.Drawing.SystemColors.Control
        Me._cmdcontrol_3.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdcontrol.SetIndex(Me._cmdcontrol_3, CType(3, Short))
        Me._cmdcontrol_3.Location = New System.Drawing.Point(64, 128)
        Me._cmdcontrol_3.Name = "_cmdcontrol_3"
        Me._cmdcontrol_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdcontrol_3.Size = New System.Drawing.Size(150, 30)
        Me._cmdcontrol_3.TabIndex = 3
        Me._cmdcontrol_3.Text = "多媒体"
        Me._cmdcontrol_3.TextAlign = System.Drawing.ContentAlignment.BottomCenter
        '
        '_cmdcontrol_2
        '
        Me._cmdcontrol_2.BackColor = System.Drawing.SystemColors.Control
        Me._cmdcontrol_2.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdcontrol.SetIndex(Me._cmdcontrol_2, CType(2, Short))
        Me._cmdcontrol_2.Location = New System.Drawing.Point(64, 88)
        Me._cmdcontrol_2.Name = "_cmdcontrol_2"
        Me._cmdcontrol_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdcontrol_2.Size = New System.Drawing.Size(150, 30)
        Me._cmdcontrol_2.TabIndex = 2
        Me._cmdcontrol_2.Text = "添加新硬件"
        Me._cmdcontrol_2.TextAlign = System.Drawing.ContentAlignment.BottomCenter
        '
        '_cmdcontrol_1
        '
        Me._cmdcontrol_1.BackColor = System.Drawing.SystemColors.Control
        Me._cmdcontrol_1.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdcontrol.SetIndex(Me._cmdcontrol_1, CType(1, Short))
        Me._cmdcontrol_1.Location = New System.Drawing.Point(64, 48)
        Me._cmdcontrol_1.Name = "_cmdcontrol_1"
        Me._cmdcontrol_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdcontrol_1.Size = New System.Drawing.Size(150, 30)
        Me._cmdcontrol_1.TabIndex = 1
        Me._cmdcontrol_1.Text = "显示"
        Me._cmdcontrol_1.TextAlign = System.Drawing.ContentAlignment.BottomCenter
        '
        '_cmdcontrol_0
        '
        Me._cmdcontrol_0.BackColor = System.Drawing.SystemColors.Control
        Me._cmdcontrol_0.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdcontrol.SetIndex(Me._cmdcontrol_0, CType(0, Short))
        Me._cmdcontrol_0.Location = New System.Drawing.Point(64, 8)
        Me._cmdcontrol_0.Name = "_cmdcontrol_0"
        Me._cmdcontrol_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdcontrol_0.Size = New System.Drawing.Size(150, 30)
        Me._cmdcontrol_0.TabIndex = 0
        Me._cmdcontrol_0.Text = "系统"
        Me._cmdcontrol_0.TextAlign = System.Drawing.ContentAlignment.BottomCenter
        '
        'cmdcontrol
        '
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.ClientSize = New System.Drawing.Size(288, 269)
        Me.Controls.Add(Me._cmdcontrol_5)
        Me.Controls.Add(Me._cmdcontrol_4)
        Me.Controls.Add(Me._cmdcontrol_3)
        Me.Controls.Add(Me._cmdcontrol_2)
        Me.Controls.Add(Me._cmdcontrol_1)
        Me.Controls.Add(Me._cmdcontrol_0)
        Me.Cursor = System.Windows.Forms.Cursors.Default
        Me.Location = New System.Drawing.Point(4, 23)
        Me.Name = "Form1"
        Me.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "访问控制面板"
        CType(Me.cmdcontrol, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
#End Region
   
    Private Sub cmdcontrol_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdcontrol.Click
        Dim Index As Short = cmdcontrol.GetIndex(eventSender)
        Dim strres As String
        Select Case Index
            Case 0
                strres = "rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl "
            Case 1
                strres = "rundll32.exe shell32.dll,Control_RunDLL desk.cpl"
            Case 2
                strres = "rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1"
            Case 3
                strres = "rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"
            Case 4
                strres = "rundll32.exe shell32.dll,Control_RunDLL powercfg.cpl"
            Case 5
                strres = "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl"
            Case Else
        End Select
        ExeControlPad(strres)
    End Sub
    Function ExeControlPad(ByVal lpparam As String) As Object
        Dim pId, pHnd As Integer
        pId = Shell(lpparam, AppWinStyle.NormalFocus)
        ' 取得 Process Handle
        pHnd = OpenProcess(SYNCHRONIZE, 0, pId)
        If pHnd <> 0 Then
            ' 等待程序结束
            Call WaitForSingleObject(pHnd, INFINITE)
            Call CloseHandle(pHnd)
        End If

    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -