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

📄 power.frm

📁 不错的一个VB菜单设计 界面和功能都不错
💻 FRM
字号:
VERSION 5.00
Object = "{75D4F148-8785-11D3-93AD-0000832EF44D}#3.1#0"; "FAST2003.ocx"
Begin VB.Form frmPower 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Power..."
   ClientHeight    =   3630
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   Icon            =   "Power.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3630
   ScaleWidth      =   4680
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame fraFrame 
      Height          =   1770
      Index           =   1
      Left            =   180
      TabIndex        =   9
      Top             =   135
      Width           =   4245
      Begin VB.Label lblLabel 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "dummy text"
         Height          =   195
         Index           =   4
         Left            =   135
         TabIndex        =   14
         Top             =   1125
         Width           =   795
      End
      Begin VB.Label lblLabel 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "dummy text"
         Height          =   195
         Index           =   3
         Left            =   135
         TabIndex        =   13
         Top             =   1395
         Width           =   795
      End
      Begin VB.Label lblLabel 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "dummy text"
         Height          =   195
         Index           =   2
         Left            =   135
         TabIndex        =   12
         Top             =   855
         Width           =   795
      End
      Begin VB.Label lblLabel 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "dummy text"
         Height          =   195
         Index           =   1
         Left            =   135
         TabIndex        =   11
         Top             =   585
         Width           =   795
      End
      Begin VB.Label lblLabel 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "dummy text"
         Height          =   195
         Index           =   0
         Left            =   135
         TabIndex        =   10
         Top             =   315
         Width           =   795
      End
   End
   Begin VB.CommandButton cmdProperties 
      Caption         =   "Properties..."
      Height          =   375
      Left            =   2970
      TabIndex        =   8
      Top             =   3195
      Width           =   1455
   End
   Begin VB.Frame fraFrame 
      Height          =   1185
      Index           =   0
      Left            =   180
      TabIndex        =   1
      Top             =   1890
      Width           =   4245
      Begin VB.CommandButton cmdLowPower 
         Caption         =   "Change..."
         Height          =   330
         Left            =   3015
         TabIndex        =   7
         Top             =   675
         Width           =   1050
      End
      Begin VB.CommandButton cmdPowerOff 
         Caption         =   "Change..."
         Height          =   330
         Left            =   3015
         TabIndex        =   6
         Top             =   270
         Width           =   1050
      End
      Begin VB.TextBox txtLowPower 
         Height          =   330
         Left            =   1935
         TabIndex        =   5
         Top             =   675
         Width           =   960
      End
      Begin VB.TextBox txtPowerOff 
         Height          =   330
         Left            =   1935
         TabIndex        =   4
         Top             =   270
         Width           =   960
      End
      Begin VB.CheckBox chkLowPower 
         Caption         =   "Low power active"
         Height          =   285
         Left            =   135
         TabIndex        =   3
         Top             =   675
         Width           =   1680
      End
      Begin VB.CheckBox chkPowerOff 
         Caption         =   "Power off active"
         Height          =   285
         Left            =   135
         TabIndex        =   2
         Top             =   270
         Width           =   1725
      End
   End
   Begin VB.CommandButton cmdSuspend 
      Caption         =   "Suspend"
      Height          =   375
      Left            =   1305
      TabIndex        =   0
      Top             =   3195
      Width           =   1455
   End
   Begin FLWSystem.FWPower objPower 
      Left            =   150
      Top             =   3135
      _ExtentX        =   820
      _ExtentY        =   820
   End
End
Attribute VB_Name = "frmPower"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub Form_Load()
  Call MyRefresh
End Sub

Private Sub cmdLowPower_Click()
  objPower.LowPowerTimeout = txtLowPower.Text
  objPower.LowPowerActive = (chkLowPower = vbChecked)
  Call MyRefresh
End Sub

Private Sub cmdPowerOff_Click()
  objPower.PowerOffTimeout = txtPowerOff.Text
  objPower.PowerOffActive = (chkPowerOff = vbChecked)
  Call MyRefresh
End Sub

Private Sub MyRefresh()
  Dim blnEnabled As Boolean
  Dim objControl As Object
  
  Call objPower.Refresh
  
  blnEnabled = objPower.Installed
  
  For Each objControl In Me.Controls
    objControl.Enabled = blnEnabled
  Next
  
  If blnEnabled Then
    Me.Caption = "Battery installed"
  Else
    Me.Caption = "Battery not installed"
  End If
  
  Select Case objPower.BatteryStatus
    Case FLWSystem.flwPowerBatteryUnknown
      lblLabel(0) = "Power battery unknown"
    Case FLWSystem.flwPowerBatteryNoPresent
      lblLabel(0) = "Power battery not present"
    Case FLWSystem.flwPowerBatteryLow
      lblLabel(0) = "Power battery low"
    Case FLWSystem.flwPowerBatteryHigh
      lblLabel(0) = "Power battery high"
    Case FLWSystem.flwPowerBatteryCritical
      lblLabel(0) = "Power battery critical"
    Case FLWSystem.flwPowerBatteryCharging
      lblLabel(0) = "Power battery charging"
  End Select
  
  Select Case objPower.ACLineStatus
    Case FLWSystem.flwPowerStatusOn
      lblLabel(1) = "Power status on"
    Case FLWSystem.flwPowerStatusOff
      lblLabel(1) = "Power status off"
    Case FLWSystem.flwPowerUnknown
      lblLabel(1) = "Power status unknown"
  End Select

  lblLabel(2) = "Battery full life time: " & objPower.BatteryFullLifeTime & " minutes"
  lblLabel(3) = "Battery life percent  : " & objPower.BatteryLifePercent & "%"
  lblLabel(4) = "Battery life time     : " & objPower.BatteryLifeTime & " minutes"

  chkPowerOff.Value = IIf(objPower.PowerOffActive, vbChecked, vbUnchecked)
  chkLowPower.Value = IIf(objPower.LowPowerActive, vbChecked, vbUnchecked)
  
  txtPowerOff.Text = objPower.PowerOffTimeout
  txtLowPower.Text = objPower.LowPowerTimeout
End Sub

Private Sub cmdSuspend_Click()
  Call objPower.Suspend(FLWSystem.flwSuspendHibernate, True)
End Sub

Private Sub cmdProperties_Click()
  Call objPower.ShowProperties
End Sub


⌨️ 快捷键说明

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