📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
AutoRedraw = -1 'True
BackColor = &H8000000A&
Caption = "Form1"
ClientHeight = 3510
ClientLeft = 60
ClientTop = 345
ClientWidth = 8115
LinkTopic = "Form1"
ScaleHeight = 3510
ScaleWidth = 8115
StartUpPosition = 3 'Windows Default
Begin VB.Timer Timer1
Interval = 100
Left = 3240
Top = 1800
End
Begin VB.CommandButton Command6
Caption = "保存文件"
Height = 495
Left = 1440
TabIndex = 6
Top = 2760
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "背景颜色"
Height = 495
Left = 4080
TabIndex = 5
Top = 2760
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "淡入淡出效果"
Height = 495
Left = 6720
TabIndex = 4
Top = 2760
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "文本字体"
Height = 495
Left = 5400
TabIndex = 3
Top = 2760
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "文本颜色"
Height = 495
Left = 2760
TabIndex = 2
Top = 2760
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "打开文件"
Height = 495
Left = 120
TabIndex = 1
Top = 2760
Width = 1215
End
Begin VB.TextBox Text1
Height = 2415
Left = 120
MultiLine = -1 'True
TabIndex = 0
Top = 120
Width = 7815
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2160
Top = 3120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim red As Integer
Dim green As Integer
Dim blue As Integer
Dim inout As Boolean
Dim dx As Integer
Dim r As Integer
Private Sub Command1_Click()
Dim fileso As New Scripting.FileSystemObject
Dim ts As TextStream
CommonDialog1.FileName = ""
CommonDialog1.Flags = cdlOFNNoReadOnlyReturn
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
CommonDialog1.FilterIndex = 1
CommonDialog1.DialogTitle = "打开文件:"
CommonDialog1.Action = 1
If CommonDialog1.FileName = "" Then
Else
Set ts = fileso.OpenTextFile(CommonDialog1.FileName, ForReading, False)
Text1.Text = ts.ReadAll
End If
End Sub
Private Sub Command2_Click()
CommonDialog1.Flags = cdlCCRGBInit
CommonDialog1.Color = BackColor
CommonDialog1.Action = 3
Text1.ForeColor = CommonDialog1.Color
End Sub
Private Sub Command3_Click()
CommonDialog1.FontName = "System"
CommonDialog1.Flags = 3
CommonDialog1.Action = 4
Text1.FontName = CommonDialog1.FontName
Text1.FontSize = CommonDialog1.FontSize
Text1.FontBold = CommonDialog1.FontBold
Text1.FontItalic = CommonDialog1.FontItalic
Text1.FontUnderline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
End Sub
Private Sub Command4_Click()
red = 192
green = 192
blue = 192
r = 1
Text1.ForeColor = RGB(red, green, blue)
Text1.FontSize = 50
Timer1.Enabled = True
inout = Not inout
Text1.Left = 8000
End Sub
Private Sub Command5_Click()
CommonDialog1.Flags = cdlCCRGBInit
CommonDialog1.Color = BackColor
CommonDialog1.Action = 3
Text1.BackColor = CommonDialog1.Color
End Sub
Private Sub Command6_Click()
Dim fileso As New Scripting.FileSystemObject
Dim ts As TextStream
CommonDialog1.FileName = ""
CommonDialog1.Flags = cdlOFNNooverwriteprompt
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
CommonDialog1.FilterIndex = 1
CommonDialog1.DialogTitle = "保存文件:"
CommonDialog1.Action = 2
If CommonDialog1.FileName = "" Then
Else
Set ts = fileso.CreateTextFile(CommonDialog1.FileName, True)
ts.Write Text1.Text
End If
End Sub
Private Sub form_load()
Timer1.Enabled = False
inout = False
End Sub
Private Sub timer1_timer()
If Text1.Left > 120 Then
Text1.Left = Text1.Left - 50
End If
If r = 1 Then
red = red + 1
green = green - 3
blue = blue - 3
Command4.Caption = "淡入"
If blue = 0 Then r = 2
End If
If r = 2 Then
red = red - 1
green = green + 3
blue = blue + 3
Command4.Caption = "淡出"
If blue = 192 Then r = 1
End If
Text1.ForeColor = RGB(red, green, blue)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -