?? form1.frm
字號:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form Form1
Caption = "編譯器"
ClientHeight = 4935
ClientLeft = 165
ClientTop = 855
ClientWidth = 7395
LinkTopic = "Form1"
ScaleHeight = 4935
ScaleWidth = 7395
StartUpPosition = 3 '窗口缺省
Begin RichTextLib.RichTextBox RichTextBox1
Height = 4935
Left = 0
TabIndex = 0
Top = 0
Width = 7455
_ExtentX = 13150
_ExtentY = 8705
_Version = 393217
Enabled = -1 'True
ScrollBars = 2
TextRTF = $"Form1.frx":0000
End
Begin VB.Menu mnuFile
Caption = "文件(&F)"
Begin VB.Menu mnuFileNew
Index = 1
End
Begin VB.Menu mnuFileOpen
Caption = "打開(&O)"
Index = 2
End
Begin VB.Menu mnuFileExit
Caption = "關閉(&X)"
Index = 3
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
RichTextBox1.Text = ""
End Sub
Private Sub mnuFileExit_Click(Index As Integer)
Unload Form1
End Sub
Private Sub mnuFileNew_Click(Index As Integer)
RichTextBox1.Text = ""
End Sub
Private Sub mnuFileOpen_Click(Index As Integer)
Dim filename As String
Dim filenumber As Integer
Dim filelength As Long
Dim filetext As String
Static myfileshuzu()
Dim i As Long
Dim wordstart As Long
Dim wordlength As Long
Dim mykey As String
Dim mycounter As Long
Dim filewordstart As Long
Dim filewordlength As Long
Static flagb As Boolean
Static flagg As Boolean
Static flags As Boolean
Static flagy As Boolean
Static flagd As Boolean
Static flag As Boolean
Dim counterd As Integer
Dim countery As Integer
filename = InputBox("請輸入文件名:", "打開文件", "e:\text.txt")
filenumber = FreeFile
filelength = FileLen(filename)
Open filename For Input As filenumber
filetext = Input(filelength, filenumber)
Close filenumber
ReDim myfileshuzu(filelength)
For i = 1 To filelength Step 1
myfileshuzu(i) = Mid$(filetext, i, 1)
Next i
RichTextBox1.Text = filetext
For filewordlength = 1 To filelength Step 1
'當檢查到空格或回車時
If (myfileshuzu(filewordlength) = Chr(32) Or myfileshuzu(filewordlength) = Chr(13) Or myfileshuzu(filewordlength) = Chr(9)) And flag = False And flagy = False And flagd = False Then
'改變字體顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(255, 0, 0)
RichTextBox1.SelStart = m
wordstart = mycounter + 1
For wordstart = wordstart To filewordlength Step 1
If (myfileshuzu(wordstart) >= "a" And myfileshuzu(wordstart) <= "z") Or (myfileshuzu(wordstart) >= "A" And myfileshuzu(wordstart) <= "Z") Or (myfileshuzu(wordstart) >= "0" And myfileshuzu(wordstart) <= "9") Then
Exit For
End If
Next wordstart
If wordstart > filewordlength Then
wordstart = filewordlength
End If
flagb = biaoshifu(myfileshuzu(), wordstart, filewordlength)
'改變表示符的顏色
If flagb = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(240, 171, 5)
RichTextBox1.SelStart = m
End If
flags = shuzi(myfileshuzu(), wordstart, filewordlength)
'改變數字的顏色
If flags = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(36, 36, 100)
RichTextBox1.SelStart = m
End If
mykey = Mid$(filetext, wordstart, filewordlength - wordstart)
flagg = guanjianzi(mykey)
If flagg = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(45, 21, 125)
RichTextBox1.SelStart = m
mycounter = filewordlength
End If
mycounter = filewordlength
ElseIf myfileshuzu(filewordlength) = Chr(59) And flag = False And flagy = False And flagd = False Then
'當按下的是分號
'改變字體顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(255, 0, 0)
RichTextBox1.SelStart = m
wordstart = mycounter + 1
For wordstart = wordstart To filewordlength Step 1
If (myfileshuzu(wordstart) >= "a" And myfileshuzu(wordstart) <= "z") Or (myfileshuzu(wordstart) >= "A" And myfileshuzu(wordstart) <= "Z") Or (myfileshuzu(wordstart) >= "0" And myfileshuzu(wordstart) <= "9") Then
Exit For
End If
Next wordstart
If wordstart > filewordlength Then
wordstart = filewordlength
End If
flagb = biaoshifu(myfileshuzu(), wordstart, filewordlength)
'改變表示符的顏色
If flagb = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(240, 171, 5)
RichTextBox1.SelStart = m
End If
flags = shuzi(myfileshuzu(), wordstart, filewordlength)
'改變數字的顏色
If flags = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(36, 36, 100)
RichTextBox1.SelStart = m
End If
mykey = Mid$(filetext, wordstart, filewordlength - wordstart)
flagg = guanjianzi(mykey)
If flagg = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(45, 21, 125)
RichTextBox1.SelStart = m
mycounter = filewordlength
End If
m = RichTextBox1.SelStart
RichTextBox1.SelStart = filewordlength - 1
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = RGB(0, 0, 255)
RichTextBox1.SelStart = m
mycounter = filewordlength
ElseIf myfileshuzu(filewordlength) = Chr(44) And flag = False And flagy = False And flagd = False Then '當按下的是逗號
'改變字體顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(255, 0, 0)
RichTextBox1.SelStart = m
wordstart = mycounter + 1
For wordstart = wordstart To filewordlength Step 1
If (myfileshuzu(wordstart) >= "a" And myfileshuzu(wordstart) <= "z") Or (myfileshuzu(wordstart) >= "A" And myfileshuzu(wordstart) <= "Z") Or (myfileshuzu(wordstart) >= "0" And myfileshuzu(wordstart) <= "9") Then
Exit For
End If
Next wordstart
If wordstart > filewordlength Then
wordstart = filewordlength
End If
flagb = biaoshifu(myfileshuzu(), wordstart, filewordlength)
'改變表示符的顏色
If flagb = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(240, 171, 5)
RichTextBox1.SelStart = m
End If
flags = shuzi(myfileshuzu(), wordstart, filewordlength)
'改變數字的顏色
If flags = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(36, 36, 100)
RichTextBox1.SelStart = m
End If
mykey = Mid$(filetext, wordstart, filewordlength - wordstart)
flagg = guanjianzi(mykey)
If flagg = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(45, 21, 125)
RichTextBox1.SelStart = m
mycounter = filewordlength
End If
m = RichTextBox1.SelStart
RichTextBox1.SelStart = filewordlength - 1
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = RGB(0, 0, 255)
RichTextBox1.SelStart = m
mycounter = filewordlength
ElseIf myfileshuzu(filewordlength) = Chr(123) And flag = False And flagy = False And flagd = False Then '當按下的是左大括號
'改變字體顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(255, 0, 0)
RichTextBox1.SelStart = m
wordstart = mycounter + 1
For wordstart = wordstart To filewordlength Step 1
If (myfileshuzu(wordstart) >= "a" And myfileshuzu(wordstart) <= "z") Or (myfileshuzu(wordstart) >= "A" And myfileshuzu(wordstart) <= "Z") Or (myfileshuzu(wordstart) >= "0" And myfileshuzu(wordstart) <= "9") Then
Exit For
End If
Next wordstart
If wordstart > filewordlength Then
wordstart = filewordlength
End If
flagb = biaoshifu(myfileshuzu(), wordstart, filewordlength)
'改變表示符的顏色
If flagb = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(240, 171, 5)
RichTextBox1.SelStart = m
End If
flags = shuzi(myfileshuzu(), wordstart, filewordlength)
'改變數字的顏色
If flags = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(36, 36, 100)
RichTextBox1.SelStart = m
End If
mykey = Mid$(filetext, wordstart, filewordlength - wordstart)
flagg = guanjianzi(mykey)
If flagg = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(45, 21, 125)
RichTextBox1.SelStart = m
mycounter = filewordlength
End If
'改變左大括號的顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = filewordlength - 1
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = RGB(0, 0, 255)
RichTextBox1.SelStart = m
mycounter = filewordlength
ElseIf myfileshuzu(filewordlength) = Chr(125) And flag = False And flagy = False And flagd = False Then '當按下的是右大括號
'改變字體顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(255, 0, 0)
RichTextBox1.SelStart = m
For wordstart = mycounter To filewordlength Step 1
If (myfileshuzu(wordstart) >= "a" And myfileshuzu(wordstart) <= "z") Or (myfileshuzu(wordstart) >= "A" And myfileshuzu(wordstart) <= "Z") Or (myfileshuzu(wordstart) >= "0" And myfileshuzu(wordstart) <= "9") Then
Exit For
End If
Next wordstart
If wordstart > filewordlength Then
wordstart = filewordlength
End If
flagb = biaoshifu(myfileshuzu(), wordstart, filewordlength)
'改變表示符的顏色
If flagb = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(240, 171, 5)
RichTextBox1.SelStart = m
End If
flags = shuzi(myfileshuzu(), wordstart, filewordlength)
'改變數字的顏色
If flags = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(36, 36, 100)
RichTextBox1.SelStart = m
End If
mykey = Mid$(filetext, wordstart, filewordlength - wordstart)
flagg = guanjianzi(mykey)
If flagg = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(45, 21, 125)
RichTextBox1.SelStart = m
mycounter = filewordlength
End If
'改變右大括號的顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = filewordlength - 1
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = RGB(0, 0, 255)
RichTextBox1.SelStart = m
mycounter = filewordlength
ElseIf myfileshuzu(filewordlength) = Chr(91) And flag = False And flagy = False And flagd = False Then '當按下的是左中括號
'改變字體顏色
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(255, 0, 0)
RichTextBox1.SelStart = m
wordstart = mycounter + 1
For wordstart = wordstart To filewordlength Step 1
If (myfileshuzu(wordstart) >= "a" And myfileshuzu(wordstart) <= "z") Or (myfileshuzu(wordstart) >= "A" And myfileshuzu(wordstart) <= "Z") Or (myfileshuzu(wordstart) >= "0" And myfileshuzu(wordstart) <= "9") Then
Exit For
End If
Next wordstart
If wordstart > filewordlength Then
wordstart = filewordlength
End If
flagb = biaoshifu(myfileshuzu(), wordstart, filewordlength)
'改變表示符的顏色
If flagb = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(240, 171, 5)
RichTextBox1.SelStart = m
End If
flags = shuzi(myfileshuzu(), wordstart, filewordlength)
'改變數字的顏色
If flags = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(36, 36, 100)
RichTextBox1.SelStart = m
End If
mykey = Mid$(filetext, wordstart, filewordlength - wordstart)
flagg = guanjianzi(mykey)
If flagg = True Then
m = RichTextBox1.SelStart
RichTextBox1.SelStart = mycounter
RichTextBox1.SelLength = filewordlength - mycounter
RichTextBox1.SelColor = RGB(45, 21, 125)
RichTextBox1.SelStart = m
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -