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

📄 pro_4.frm

📁 是API教程4
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Lesson4_4"
   ClientHeight    =   4185
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6690
   LinkTopic       =   "Form1"
   ScaleHeight     =   4185
   ScaleWidth      =   6690
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text1 
      Height          =   1350
      Left            =   1560
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   2760
      Width           =   4935
   End
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00FFFFFF&
      Height          =   2475
      Left            =   1560
      ScaleHeight     =   2415
      ScaleWidth      =   4875
      TabIndex        =   0
      Top             =   60
      Width           =   4935
   End
   Begin VB.Label Label1 
      Caption         =   "Text控件"
      Height          =   315
      Left            =   660
      TabIndex        =   3
      Top             =   2880
      Width           =   1335
   End
   Begin VB.Label P 
      Caption         =   "PictureBox控件"
      Height          =   255
      Left            =   180
      TabIndex        =   2
      Top             =   240
      Width           =   1515
   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 CreateCaret& Lib "user32" (ByVal hwnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long)
Private Declare Function ShowCaret& Lib "user32" (ByVal hwnd As Long)
Private Declare Function SetCaretPos& Lib "user32" (ByVal x As Long, ByVal y As Long)
Private Declare Function HideCaret& Lib "user32" (ByVal hwnd As Long)

Private Declare Function DestroyCaret& Lib "user32" ()




Private Sub Form_Load()
    Form1.ScaleMode = vbPixels
    Picture1.ScaleMode = vbPixels
    Picture1.FontSize = 14
End Sub

Private Sub Picture1_Click()
   ' Picture1_GotFocus
End Sub

Private Sub Picture1_GotFocus()
    Dim dl&
    Dim CreateHeight As Integer
    
    CreateHeight = Picture1.TextHeight("I")
    dl& = CreateCaret(Picture1.hwnd, 0, 2, CreateHeight)
    dl& = SetCaretPos(Picture1.CurrentX, Picture1.CurrentY)
    dl& = ShowCaret(Picture1.hwnd)
End Sub

Private Sub Picture1_KeyPress(KeyAscii As Integer)
    Dim dl&

    dl& = HideCaret(Picture1.hwnd)
    Picture1.Print Chr(KeyAscii);
        If Picture1.CurrentX >= (Picture1.Width - Picture1.TextWidth("W")) Then '换行
           Picture1.CurrentX = 0
           Picture1.CurrentY = Picture1.CurrentY + Picture1.TextHeight("I")
        End If
    dl& = SetCaretPos(Picture1.CurrentX, Picture1.CurrentY)
    dl& = ShowCaret(Picture1.hwnd)
End Sub

Private Sub Picture1_LostFocus()
     Dim dl&
 '   dl& = DestroyCaret
End Sub

⌨️ 快捷键说明

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