# Re: 大概是这样吧

Posted by dino on August 24, 1999 at 19:40:39:

In Reply to: 是这样的: 我对 textbox.text 填入 ex: &hFB40 (目前没有字型) 所以 textbox 就显示一空白, 我希望能用一符号来代替此一空白 如 一个 "□" posted by Albert Chiu ~~~ on August 24, 1999 at 16:35:08:

Private Sub Text1_Change()
Dim i As Integer
Dim strByte() As Byte
Dim strReplace As String

On Error Resume Next

strReplace = "□"
Text2.Text = ""
strByte = StrConv(Mid(Text1.Text, Text1.SelStart, 1), vbFromUnicode)
Text2.Text = Hex(strByte(0)) & Hex(strByte(1))

If Text2.Text = "FB40" Then
If Text1.SelStart < Len(Text1.Text) Then
i = Text1.SelStart
Text1.Text = Mid(Text1.Text, 1, CLng(Text1.SelStart - 1)) & strReplace & Mid(Text1.Text, CLng(Text1.SelStart + 1))
Text1.SelStart = i
Else
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1) & strReplace
Text1.SelStart = Len(Text1.Text)
End If
End If

End Sub

text1当输入box
text2会显示内码以便check

匆忙写的...可以跑....但 code还不精简

Follow Ups:

- Thank yor for your answer !! Do you know how to change 使用者造字档 by VB program ? Albert Chiu ~~~ 09:26:10 8/25/99 (0)