'picBuffer 即"文字打印区", txtText 即"文字输出区"
Dim i As Integer, j As Integer
Dim strWord As String * 1, strTemp As String
Dim bIsLineEmpty As Boolean
strWord = txtWord.Text
picBuffer.Cls
picBuffer.ScaleLeft = 0
picBuffer.ScaleTop = 0
picBuffer.Print txtWord.Text
txtWord.Enabled = False
txtFill.Enabled = False
txtText.Text = ""
lblStatus.Caption = "正在生成图形......"
For i = 1 To picBuffer.TextHeight("I") - 20 Step 45 '这里设定每隔 45 个缇(VB 通用长度单位)检查一列中的像素点
bIsLineEmpty = True
For j = 1 To picBuffer.TextWidth(txtWord.Text) - 20 Step 25 '设定每隔 25 个缇检查一行中的像素点
txtText.SelStart = Len(txtText.Text)
If picBuffer.Point(j, i) = vbBlack Then '如果获得的像素是黑色
strTemp = strTemp & txtFill.Text '在相应地方显示一个组合字
bIsLineEmpty = False
Else
strTemp = strTemp & " " '如果是白色,则插入一个空格
End If
Next j
If (bIsLineEmpty = True) And (chkOptions(0).Value = vbChecked) Then
strTemp = ""
Else
strTemp = strTemp & vbCrLf
End If
txtText.SelText = strTemp
strTemp = ""
Next i