设置鼠标指针.frm

来自「个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助」· FRM 代码 · 共 53 行

FRM
53
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "恢复"
      Height          =   315
      Left            =   2340
      TabIndex        =   1
      Top             =   1320
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "动画指针"
      Height          =   315
      Left            =   1200
      TabIndex        =   0
      Top             =   1320
      Width           =   855
   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 LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function GetCursor Lib "user32" () As Long
Private Declare Function CopyCursor Lib "user32" (ByVal hcur As Long) As Long
Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
Private Const OCR_Normal = 32512
Dim NewCursor As Long
Dim OldCursor As Long

Private Sub Command1_Click()
    NewCursor = LoadCursorFromFile("d:\pictures\coin.ani")
    OldCursor = GetCursor()
    'OldCursor = CopyCursor(OldCursor)此API函数在Windows 2000下无法通过
    SetSystemCursor NewCursor, OCR_Normal
End Sub

Private Sub Command2_Click()
    SetSystemCursor OldCursor, OCR_Normal
End Sub

⌨️ 快捷键说明

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