📄 单击文本框获取单击位置.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "CharPos.vbp"
ClientHeight = 2115
ClientLeft = 60
ClientTop = 345
ClientWidth = 5100
LinkTopic = "Form1"
ScaleHeight = 141
ScaleMode = 3 'Pixel
ScaleWidth = 340
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text1
BeginProperty Font
Name = "MS Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1815
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Text = "单击文本框获取单击位置.frx":0000
Top = 120
Width = 4695
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 Sub Text1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim pos As Long, lc As Long
Dim Line As Integer, CharPos As Integer
x = x / Screen.TwipsPerPixelX
y = y / Screen.TwipsPerPixelY
pos = x + y * 65536
lc = SendMessage(Text1.hwnd, EM_CHARFROMPOS, 0, ByVal pos)
Line = lc \ 65536
CharPos = lc Mod 65536
MsgBox "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -