📄 改变屏幕亮度.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2955
ClientLeft = 3585
ClientTop = 2730
ClientWidth = 3495
LinkTopic = "Form1"
ScaleHeight = 197
ScaleMode = 3 'Pixel
ScaleWidth = 233
Begin VB.PictureBox Picture1
Height = 2505
Left = 60
Picture = "改变屏幕亮度.frx":0000
ScaleHeight = 163
ScaleMode = 3 'Pixel
ScaleWidth = 219
TabIndex = 2
Top = 30
Width = 3345
End
Begin VB.CommandButton Command2
Caption = "复 原"
Height = 285
Left = 2370
TabIndex = 1
Top = 2610
Width = 975
End
Begin VB.CommandButton Command1
Caption = "变 暗"
Height = 285
Left = 1380
TabIndex = 0
Top = 2610
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function CreatePatternBrush Lib "gdi32" (ByVal BitmapH As Long) As Long
Private Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, ByVal lpRect As Long, ByVal bErase As Long) As Long
Dim Bits(1 To 16) As Byte
Private Sub Form_Load()
Dim Ary As Variant
Dim I As Integer
Ary = Array(&H55, &H0, &HAA, &H0, &H55, &H0, &HAA, &H0, &H55, &H0, &HAA, &H0, &H55, &H0, &HAA, &H0)
For I = 1 To 16
Bits(I) = Ary(I - 1)
Next I
End Sub
Private Sub Command1_Click()
Dim hdc As Long, Width As Long, Height As Long
Dim BitmapH As Long, BrushH As Long
Dim Rop As Long
BitmapH = CreateBitmap(8, 8, 1, 1, Bits(1))
BrushH = CreatePatternBrush(BitmapH)
hdc = GetDC(0)
Width = Screen.Width \ Screen.TwipsPerPixelX
Height = Screen.Height \ Screen.TwipsPerPixelY
Rop = &HA000C9
SelectObject hdc, BrushH
PatBlt hdc, 0, 0, Width, Height, Rop
DeleteObject BrushH
ReleaseDC 0, hdc
AAA.Show
End Sub
Private Sub Command2_Click()
InvalidateRect 0, 0, 1
Unload Me
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -