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

📄 form1.frm

📁 很好的教程原代码!
💻 FRM
字号:
VERSION 5.00
Begin VB.Form EndDialog 
   AutoRedraw      =   -1  'True
   BorderStyle     =   0  'None
   Caption         =   "关闭  "
   ClientHeight    =   4470
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   6840
   Icon            =   "form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   4470
   ScaleWidth      =   6840
   ShowInTaskbar   =   0   'False
   Begin VB.PictureBox Main_Board 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   2820
      Left            =   0
      Picture         =   "form1.frx":000C
      ScaleHeight     =   2820
      ScaleWidth      =   5085
      TabIndex        =   0
      Top             =   0
      Width           =   5085
      Begin VB.OptionButton ShutDownComputer 
         Caption         =   "关闭计算机?(&S)"
         Height          =   240
         Left            =   900
         TabIndex        =   6
         Top             =   960
         Width           =   1695
      End
      Begin VB.OptionButton RebootComputer 
         Caption         =   "重新启动计算机?(&R)"
         Height          =   240
         Left            =   900
         TabIndex        =   5
         Top             =   1260
         Width           =   2055
      End
      Begin VB.OptionButton ExitUser 
         Caption         =   "注销用户?(&E)"
         Height          =   240
         Left            =   900
         TabIndex        =   4
         Top             =   1560
         Value           =   -1  'True
         Width           =   3435
      End
      Begin VB.CommandButton BotYes 
         Caption         =   "是(&Y)"
         Height          =   315
         Left            =   540
         TabIndex        =   3
         Top             =   2280
         Width           =   1155
      End
      Begin VB.CommandButton BotNo 
         Caption         =   "否(&N)"
         Height          =   315
         Left            =   2040
         TabIndex        =   2
         Top             =   2280
         Width           =   1155
      End
      Begin VB.CommandButton BotHelp 
         Caption         =   "帮助(&H)"
         Enabled         =   0   'False
         Height          =   315
         Left            =   3540
         TabIndex        =   1
         Top             =   2280
         Width           =   1155
      End
      Begin VB.Image PicSw 
         Height          =   195
         Left            =   4770
         Picture         =   "form1.frx":7EDE
         Top             =   75
         Width           =   225
      End
   End
   Begin VB.Image PicUp 
      Height          =   195
      Left            =   2760
      Picture         =   "form1.frx":7F9E
      Top             =   3000
      Visible         =   0   'False
      Width           =   225
   End
   Begin VB.Image PicDn 
      Height          =   195
      Left            =   3060
      Picture         =   "form1.frx":805E
      Top             =   3000
      Visible         =   0   'False
      Width           =   225
   End
End
Attribute VB_Name = "EndDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub BotHelp_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc("S") Or KeyAscii = Asc("s") Then ShutDownComputer.SetFocus
    If KeyAscii = Asc("R") Or KeyAscii = Asc("r") Then RebootComputer.SetFocus
    If KeyAscii = Asc("E") Or KeyAscii = Asc("e") Then ExitUser.SetFocus
End Sub

Private Sub BotNo_Click()
    EndDialog.Hide
    Unload EndDialog
End Sub

Private Sub BotNo_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc("S") Or KeyAscii = Asc("s") Then ShutDownComputer.SetFocus
    If KeyAscii = Asc("R") Or KeyAscii = Asc("r") Then RebootComputer.SetFocus
    If KeyAscii = Asc("E") Or KeyAscii = Asc("e") Then ExitUser.SetFocus
End Sub

Private Sub BotYes_Click()
' 是按钮被按下
    Dim AboutRet As Long
    If ShutDownComputer.Value Then
        Unload Me
        AboutRet = ExitWindowsEx(EWX_SHUTDOWN, 0)
        ' 关闭计算机
    End If
    If RebootComputer.Value Then
        Unload Me
        AboutRet = ExitWindowsEx(EWX_REBOOT, 0)
        ' 重新启动计算机
    End If
    If ExitUser.Value Then
        Unload Me
        AboutRet = ExitWindowsEx(EWX_LOGOFF, 0)
        ' 注销用户
    End If
    End
End Sub

Private Sub BotYes_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc("S") Or KeyAscii = Asc("s") Then ShutDownComputer.SetFocus
    If KeyAscii = Asc("R") Or KeyAscii = Asc("r") Then RebootComputer.SetFocus
    If KeyAscii = Asc("E") Or KeyAscii = Asc("e") Then ExitUser.SetFocus
End Sub

Private Sub ExitUser_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc("S") Or KeyAscii = Asc("s") Then ShutDownComputer.SetFocus
    If KeyAscii = Asc("R") Or KeyAscii = Asc("r") Then RebootComputer.SetFocus
    If KeyAscii = Asc("E") Or KeyAscii = Asc("e") Then ExitUser.SetFocus
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc("S") Or KeyAscii = Asc("s") Then ShutDownComputer.SetFocus
    If KeyAscii = Asc("R") Or KeyAscii = Asc("r") Then RebootComputer.SetFocus
    If KeyAscii = Asc("E") Or KeyAscii = Asc("e") Then ExitUser.SetFocus
End Sub

Private Sub Form_Load()
    Dim TmpLoop As Integer
    Main_Board.Top = (Screen.Height - Height) / 2
    Main_Board.Left = (Screen.Width - Width) / 2
    EndDialog.Height = Screen.Height
    EndDialog.Width = Screen.Width
    SetWindowPos EndDialog.hWnd, -1, EndDialog.Left / 15, EndDialog.Top / 15, _
        EndDialog.Width / 15, EndDialog.Height / 15, &H10 Or &H40
    EndDialog.Picture = CaptureWindow(GetDesktopWindow(), False, 0, 0, _
        Screen.Width \ Screen.TwipsPerPixelX, Screen.Height \ Screen.TwipsPerPixelY)
    EndDialog.Show
    For TmpLoop = -639 To 799 Step 2
      EndDialog.Line (TmpLoop * 15, 0)-((TmpLoop + 639) * 15, 639 * 15)
      EndDialog.Line ((TmpLoop + 640) * 15, 1)-(TmpLoop * 15, 640 * 15)
    Next TmpLoop
End Sub

Private Sub PicSw_Click()
    Unload EndDialog
End Sub

Private Sub PicSw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    PicSw.Picture = PicDn.Picture
End Sub

Private Sub PicSw_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    PicSw.Picture = PicUp.Picture
End Sub

Private Sub RebootComputer_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc("S") Or KeyAscii = Asc("s") Then ShutDownComputer.SetFocus
    If KeyAscii = Asc("R") Or KeyAscii = Asc("r") Then RebootComputer.SetFocus
    If KeyAscii = Asc("E") Or KeyAscii = Asc("e") Then ExitUser.SetFocus
End Sub

Private Sub ShutDownComputer_KeyPress(KeyAscii As Integer)
    If KeyAscii = Asc("S") Or KeyAscii = Asc("s") Then ShutDownComputer.SetFocus
    If KeyAscii = Asc("R") Or KeyAscii = Asc("r") Then RebootComputer.SetFocus
    If KeyAscii = Asc("E") Or KeyAscii = Asc("e") Then ExitUser.SetFocus
End Sub

⌨️ 快捷键说明

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