📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "放在显示汉字"
ClientHeight = 3450
ClientLeft = 60
ClientTop = 345
ClientWidth = 6180
LinkTopic = "Form1"
ScaleHeight = 3450
ScaleWidth = 6180
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txtQu
Height = 360
Left = 4755
TabIndex = 3
Top = 240
Width = 1230
End
Begin VB.TextBox txtWei
Height = 375
Left = 4785
TabIndex = 2
Top = 840
Width = 1230
End
Begin VB.CommandButton cmdDraw
Caption = "显示"
Height = 405
Left = 4950
TabIndex = 1
Top = 2055
Width = 1050
End
Begin VB.TextBox txtScale
Height = 375
Left = 4755
TabIndex = 0
Top = 1470
Width = 1230
End
Begin VB.Label Label1
Caption = "区码"
Height = 300
Left = 4230
TabIndex = 6
Top = 330
Width = 435
End
Begin VB.Label Label2
Caption = "位码"
Height = 315
Left = 4245
TabIndex = 5
Top = 900
Width = 435
End
Begin VB.Label Label3
Caption = "放大倍数"
Height = 270
Left = 3960
TabIndex = 4
Top = 1515
Width = 765
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 0
Option Explicit
Private Sub Form_Load()
ScaleMode = 3 '改变坐标系统
End Sub
Private Sub cmdDraw_Click()
If CInt(txtQu.Text) < 1 Or CInt(txtQu.Text) > 87 Then
MsgBox "区码应在1和87之间"
Exit Sub
End If
If CInt(txtWei.Text) < 1 Or CInt(txtWei.Text) > 94 Then
MsgBox "位码应在1和94之间"
Exit Sub
End If
If CInt(txtScale.Text) < 1 Or CInt(txtScale.Text) > 10 Then
MsgBox "放大倍数应在1和10之间"
Exit Sub
End If
Call DrawHz(txtQu.Text, txtWei.Text, txtScale.Text)
End Sub
Private Sub DrawHz(ByVal intQu As Long, ByVal intWei As Long, ByVal intScale As Integer)
Dim int1 As Integer
Dim int2 As Integer
Dim int3 As Integer
Dim int4 As Integer
Dim int5 As Integer
Dim lngOffset As Long
Dim bytinfo(31) As Byte
Cls
lngOffset = ((intQu - 1) * 94 + (intWei - 1)) * 32 + 1 '计算位置
Open "e:\wd\课件\vb例子\放大显示汉字\hzk16" For Binary As 1
Seek #1, lngOffset
For int1 = 0 To 31
Get #1, , bytinfo(int1) '读取点阵信息
Next
Close
For int1 = 0 To 15
For int2 = 0 To 1
For int3 = 0 To 7
If getbit(bytinfo(int1 * 2 + int2), 7 - int3) Then
For int4 = 0 To intScale - 1
For int5 = 0 To intScale - 1
PSet ((int2 * 8 + int3) * intScale + int5, int1 * intScale + int4)
Next
Next
End If
Next
Next
Next
End Sub
Function getbit(bytinfo As Byte, intBit As Integer) As Boolean
getbit = bytinfo And 2 ^ intBit '计算一位是1还是0
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -