📄 fontstatistics.frm
字号:
VERSION 5.00
Begin VB.Form fontstatistics
Caption = "字数统计"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "关闭"
Height = 375
Left = 3000
TabIndex = 11
Top = 2640
Width = 1095
End
Begin VB.Label Label2
Caption = "------- 统计信息 --------"
Height = 255
Left = 240
TabIndex = 10
Top = 120
Width = 1815
End
Begin VB.Label Label1
Caption = "段落数"
Height = 255
Index = 10
Left = 240
TabIndex = 9
Top = 1560
Width = 1815
End
Begin VB.Label Label1
Caption = "字符数(记空格)"
Height = 255
Index = 9
Left = 240
TabIndex = 8
Top = 1200
Width = 1815
End
Begin VB.Label Label1
Caption = "字符数(不记空格)"
Height = 255
Index = 8
Left = 240
TabIndex = 7
Top = 840
Width = 1815
End
Begin VB.Label Label1
Caption = "中文字数"
Height = 255
Index = 7
Left = 240
TabIndex = 6
Top = 480
Width = 1815
End
Begin VB.Label Label1
Caption = "行数"
Height = 255
Index = 6
Left = 240
TabIndex = 5
Top = 1920
Width = 1815
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Height = 255
Index = 4
Left = 2520
TabIndex = 4
Top = 1920
Width = 1815
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Height = 255
Index = 3
Left = 2520
TabIndex = 3
Top = 1560
Width = 1815
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Height = 255
Index = 2
Left = 2520
TabIndex = 2
Top = 1200
Width = 1815
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Height = 315
Index = 1
Left = 2520
TabIndex = 1
Top = 840
Width = 1815
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Height = 255
Index = 0
Left = 2520
TabIndex = 0
Top = 480
Width = 1815
End
End
Attribute VB_Name = "fontstatistics"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Unload fontstatistics
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim num As Integer '可打印字符数目
Dim num1 As Integer '空格数目
Dim num2 As Integer ' 字数
Dim num3 As Integer '段落数
Label1(4).Caption = SendMessage(fMainForm.ActiveForm.rtfText.hwnd, _
EM_GETLINECOUNT, 0, 0)
For i = 0 To Len(fMainForm.ActiveForm.rtfText.Text) - 1
If Asc(Mid(fMainForm.ActiveForm.rtfText.Text, i + 1, 1)) > 31 And _
Asc(Mid(fMainForm.ActiveForm.rtfText.Text, i + 1, 1)) < 126 Then
num = num + 1
End If
Next
Label1(2).Caption = num
For i = 0 To Len(fMainForm.ActiveForm.rtfText.Text) - 1
If Asc(Mid(fMainForm.ActiveForm.rtfText.Text, i + 1, 1)) = 32 Then
num1 = num1 + 1
End If
Next
Label1(1).Caption = num - num1
For i = 0 To Len(fMainForm.ActiveForm.rtfText.Text) - 1
If Asc(Mid(fMainForm.ActiveForm.rtfText.Text, i + 1, 1)) < 0 Then
num2 = num2 + 1
End If
Next
Label1(0).Caption = num2
For i = 0 To Len(fMainForm.ActiveForm.rtfText.Text) - 1
If Asc(Mid(fMainForm.ActiveForm.rtfText.Text, i + 1, 1)) = Chr(13) Then
num3 = num3 + 1
End If
Next
Label1(3).Caption = num3
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -