📄 pro_1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "lesson4_1"
ClientHeight = 4305
ClientLeft = 45
ClientTop = 330
ClientWidth = 5880
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4305
ScaleWidth = 5880
StartUpPosition = 3 'Windows Default
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H00FF8080&
ForeColor = &H80000008&
Height = 3435
Left = 420
ScaleHeight = 3405
ScaleWidth = 5025
TabIndex = 0
Top = 360
Width = 5055
Begin VB.CommandButton Command1
Caption = "剪切开始"
Height = 615
Left = 1800
TabIndex = 1
Top = 1380
Width = 1395
End
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "现在指针不能移出蓝色框外"
Height = 315
Left = 360
TabIndex = 2
Top = 120
Visible = 0 'False
Width = 4995
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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function ClipCursor& Lib "user32" (lpRect As RECT)
Private Declare Function GetClipCursor& Lib "user32" (lprc As RECT)
Private Declare Function GetWindowRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT)
Private MyRect As RECT
Private isClip As Boolean
Private Sub Command1_Click()
Dim dl&
Dim WindowRect As RECT
If isClip Then
dl& = ClipCursor(MyRect) '恢复原来的剪切区域
Command1.Caption = "剪切指针"
Else
dl& = GetClipCursor(MyRect) '保存当前的指针剪切区域
dl& = GetWindowRect(Picture1.hwnd, WindowRect) '获取picture控件在屏目中的位置(RECT)
dl& = ClipCursor(WindowRect) '指定新的剪切
Command1.Caption = "结束"
End If
isClip = Not isClip '记载是否是剪切了
Label1.Visible = Not Label1.Visible
End Sub
Private Sub Form_Load()
isClip = False '程序启动时尚未剪切
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -