以下是引用csyx在2025-9-13 08:19:39的发言:
粘贴下列代码到 Edit1.click 事件中,运行时可以看到点击位置的字符和坐标位置(相对于表单客户区原点)
只要明白了 GetCaretPos 的作用,取第二个“节”字的坐标也就易如反掌
Declare Long GetCaretPos in win32api String @
pt = BinToC(0,'rs') + BinToC(0,'rs')
GetCaretPos(@ pt)
x = CToBin(Substr(pt,1,4), 'rs')
y = CToBin(Substr(pt,5,4), 'rs')
cc = Substr(This.Text, This.SelStart+1, 1)
Do case
Case IsLeadByte(cc)
cc = ["] + Substr(This.Text, This.SelStart+1, 2) + ["]
Case Asc(cc) < 33
cc = Textmerge('CHR(<<Asc(cc)>>)')
Otherwise
cc = ["] + cc + ["]
EndCase
cc = Textmerge('char=<<cc>>,x=<<x>>,y=<<y>>')
Wait windows cc nowait noclear
谢谢老师,这个太好了!