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

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "隐藏文本框中的光标"
   ClientHeight    =   2385
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2385
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "恢复光标"
      Height          =   495
      Left            =   2640
      TabIndex        =   2
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "隐藏光标"
      Height          =   495
      Left            =   840
      TabIndex        =   1
      Top             =   1440
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   840
      TabIndex        =   0
      Text            =   "http://zmhh.mycool.net"
      Top             =   240
      Width           =   3015
   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 HideCaret Lib "user32" (ByVal hwnd As Long) As Long
Private carshow As Boolean

Private Sub Form_Load()
    carshow = True
End Sub

Private Sub Command1_Click()
    carshow = False
End Sub

Private Sub Command2_Click()
    carshow = True
    Text1.SetFocus
End Sub

Private Sub Text1_GotFocus()
    If Not carshow Then
        DoEvents
        Call HideCaret(Text1.hwnd)
    End If
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If Not carshow Then
        DoEvents
        Call HideCaret(Text1.hwnd)
    End If
End Sub

⌨️ 快捷键说明

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