例[9-12].frm

来自「蒋加伏主编VB程序设计第四版PPT及全部课本源码 北京邮电大学出版社 」· FRM 代码 · 共 95 行

FRM
95
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "例[9-12] 文本格式化"
   ClientHeight    =   2895
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   3675
   LinkTopic       =   "Form1"
   ScaleHeight     =   2895
   ScaleWidth      =   3675
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   2775
      Left            =   120
      MultiLine       =   -1  'True
      TabIndex        =   0
      Top             =   0
      Width           =   3375
   End
   Begin VB.Menu InpInfo 
      Caption         =   "输入信息"
      Begin VB.Menu INput 
         Caption         =   "输入"
      End
      Begin VB.Menu Exit 
         Caption         =   "退出"
      End
   End
   Begin VB.Menu DisInfo 
      Caption         =   "显示信息"
      Begin VB.Menu Display 
         Caption         =   "显示"
      End
      Begin VB.Menu Clean 
         Caption         =   "清除"
      End
   End
   Begin VB.Menu Format 
      Caption         =   "格式"
      Begin VB.Menu Normal 
         Caption         =   "正常"
      End
      Begin VB.Menu Bold 
         Caption         =   "粗体"
      End
      Begin VB.Menu Italic 
         Caption         =   "斜体"
      End
      Begin VB.Menu Under 
         Caption         =   "下划线"
      End
      Begin VB.Menu Font20 
         Caption         =   "Font20"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim InpText As String            '窗体级变量InpText,因为被多个事件过程使用
Private Sub Bold_Click()
   Text1.FontBold = True
End Sub
Private Sub Clean_Click()
   Text1 = ″″
End Sub
Private Sub Display_Click()
   Text1 = InpText
End Sub
Private Sub Exit_Click()
   End
End Sub
Private Sub Font20_Click()
   Text1.FontSize = 20
End Sub
Private Sub Input_Click()
   Dim inpt As String
   inpt = InputBox("", "请输入一段文字")
   InpText = InpText & inpt       '输入的新文本与原有文本连接
End Sub
Private Sub Italic_Click()
   Text1.FontItalic = True
End Sub
Private Sub Normal_Click()
   Text1.FontUnderline = False
   Text1.FontItalic = False
   Text1.FontSize = 10
End Sub
Private Sub Under_Click()
    Text1.FontUnderline = True
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?