7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command1_Click()
With TextBox1
.SelStart = 5
.SelLength = 0
.SelText = ChrW(vbKeyA + Int(Rnd() * 26))
End With
End Sub
Option Explicit
Private Declare Function TextOut Lib "gdi32" Alias "TextOutW" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As Long
Private Sub Form_Load()
Dim str As String
Dim i As Long
Me.Font.Name = "Webdings"
Me.Font.Charset = 2
Me.Font.Size = 16
Me.AutoRedraw = True
For i = &H80 To &HFF
str = str & ChrW(i)
Next
TextOut Me.hdc, 0, 0, StrPtr(str), Len(str)
End Sub
还是有的能显示,有的不能显示。我贴出WORD中的插入对话框图片,是想说明这些符号应该是有规律的,如果没有规律(不确定性),那么图片上“字符代码”所指,不就是骗人吗?
要是有规律,如何将其按规律显示出来?
谢谢!Private Sub Form_Load()
Dim str As String
Dim i As Long
For i = &H80 To &HFF
str = str & ChrW(i)
Next
TextBox1.Font.Name = "Webdings"
TextBox1.Font.Charset = 2
TextBox1.Font.Size = 16
TextBox1.Text = str
End Sub
Option Explicit
Private Declare Function TextOut Lib "gdi32" Alias "TextOutW" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As Long
Private Sub Form_Load()
Dim str As String
Me.Font.Name = "Webdings"
Me.Font.Charset = 2
Me.Font.Size = 16
Me.AutoRedraw = True
str = ChrW(&HA5) & ChrW(&HA6)
TextOut Me.hdc, 0, 0, StrPtr(str), Len(str)
Me.FontName = "Wingdings"
TextOut Me.hdc, 0, 20, StrPtr(str), Len(str)
End Sub
“用其他的编码”的意思是如果要输出某个符号,尽量选字体无关、环境无关的编码。Private Sub Command1_Click()
Dim str As String
RichTextBox1.SelFontName = "webdings"
For i = &H21 To &HFF
str = ChrW(i)
SendMessageW RichTextBox1.hWnd, EM_REPLACESEL, 0, ByVal str
Next
End Sub
在上边的&H21 To &HFF中,&H21 To &H7E 之间的没有问题,其余有的显示,有的便不能正常显示。
是给的编码CHARCODE,上例中的i值有问题吗?Option Explicit
Private Declare Function TextOut Lib "gdi32" Alias "TextOutW" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As Long
Private Sub Form_Load()
Dim str As String
Me.FontName = "Times New Roman"
Me.FontSize = 16
Me.AutoRedraw = True
str = ChrW(&H2660) & ChrW(&H2663) & ChrW(&H2665) & ChrW(&H2666)
TextOut Me.hdc, 0, 0, StrPtr(str), Len(str)
End Sub
RichTextBox1.SelFontName = "webdings"
For i = A To B
str = ChrW(i)
SendMessage RichTextBox1.hWnd, EM_REPLACESEL, 0, ByVal str
Next