提供二个函数给你。
Public ASC16(15, 255) As Byte
Public Sub OpenASC16()
Dim fr As Integer
fr = FreeFile
Open App.Path & "\ASC16" For Binary Access Read As #fr
Get #fr, , ASC16
Close
'Stop
End Sub
Public Sub ViewASC16(obj As PictureBox, ASCZ As Byte, Optional X As Long = 0, Optional Y As Long = 0)
Dim i As Long, j As Long
Dim b As Byte
Dim ym(7) As Byte
Dim dk As Long
dk = Screen.TwipsPerPixelX * 15
Dim dh As Long
dh = Screen.TwipsPerPixelY * 15
For i = 1 To 7
ym(i) = 2 ^ (i - 1)
Next i
For i = 0 To 15
b = ASC16(i, ASCZ)
For j = 0 To 7
If (ym(j) And b) > 0 Then
'obj.Line ((8 - j) * dk + X, i * dh + Y)-((8 - j) * dk + dk + X, i * dh + dh + Y), 0, BF
obj.Line ((8 - j) * dk + X, i * dh + Y)-Step(dk, dh), 0, BF
End If
Next j
Next i
End Sub
ASC16 这个文件,4K 大小,自己到网上下,比较难找。
调用:
先读数据:
Call OpenASC16
再显示:
第一种,不指定坐标在左上角显示
Call ViewASC16(Picture1, CByte(Asc("G")))
第二种,带坐标显示
Call ViewASC16(Picture1, CByte(Asc("G")), 1800, 0)
因为不会清屏,所以调用显示之前,自己要清屏一下。