VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form1 
   Caption         =   "我的记事本"
   ClientHeight    =   4470
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6840
   LinkTopic       =   "Form1"
   ScaleHeight     =   4470
   ScaleWidth      =   6840
   StartUpPosition =   3  '窗口缺省
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   2745
      Top             =   1800
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command6 
      Caption         =   "退出"
      Height          =   375
      Left            =   5160
      TabIndex        =   6
      Top             =   0
      Width           =   855
   End
   Begin VB.CommandButton Command5 
      Caption         =   "打印"
      Height          =   375
      Left            =   4125
      TabIndex        =   5
      Top             =   15
      Width           =   855
   End
   Begin VB.CommandButton Command4 
      Caption         =   "文字颜色"
      Height          =   375
      Left            =   3105
      TabIndex        =   4
      Top             =   15
      Width           =   855
   End
   Begin VB.CommandButton Command3 
      Caption         =   "字体"
      Height          =   375
      Left            =   2070
      TabIndex        =   3
      Top             =   15
      Width           =   855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "保存"
      Height          =   375
      Left            =   1110
      TabIndex        =   2
      Top             =   15
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "打开"
      Height          =   375
      Left            =   150
      TabIndex        =   1
      Top             =   15
      Width           =   855
   End
   Begin VB.TextBox Text1 
      Height          =   3870
      Left            =   135
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   0
      Text            =   "Form1.frx":0000
      Top             =   495
      Width           =   6060
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim strFile As String
    CommonDialog1.ShowOpen              '显示[打开]对话框
    strFile = CommonDialog1.FileName    '获取文件名
    If strFile <> "" Then
        Open strFile For Binary As #1   '打开文件
        Text1.Text = Input$(LOF(1), #1) '读取文件数据
        Close #1                        '关闭文件
    End If
End Sub

Private Sub Command2_Click()
    Dim strFile As String
    CommonDialog1.ShowSave              '显示[另存为]对话框
    strFile = CommonDialog1.FileName    '获取文件名
    If strFile <> "" Then
        Open strFile For Binary As #1   '打开文件
        Put #1, , Text1.Text            '写入文件
        Close #1
    End If
End Sub

Private Sub Command3_Click()
    CommonDialog1.Flags = cdlCFBoth         '显示打印机字体和屏幕字体
    CommonDialog1.ShowFont                  '显示[字体]对话框
    Text1.Font = CommonDialog1.FontName     '获取字体名
    Text1.FontBold = CommonDialog1.FontBold     '粗体
    Text1.FontItalic = CommonDialog1.FontItalic '斜体
    Text1.FontSize = CommonDialog1.FontSize     '大小
End Sub

Private Sub Command4_Click()
    CommonDialog1.ShowColor                 '显示[颜色]对话框
    Text1.ForeColor = CommonDialog1.Color   '设置前景色
End Sub

Private Sub Command5_Click()
  Dim KSPAGE, JSPAGE As Integer
   CommonDialog1.Min = 1                 '设置可打印的最小页号
   CommonDialog1.Max = 100               '设置可打印的最大页号
   CommonDialog1.ShowPrinter             '设置通用对话框为[打印]对话框
   KSPAGE = CommonDialog1.FromPage       '从[打印]对话框中取出要打印的起始页号
   JSPAGE = CommonDialog1.ToPage         '从[打印]对话框中取出要打印的中止页号
   
   For I = 1 To CommonDialog1.Copies    '获取打印份数
      Printer.Print Text1.Text           '打印文本框Text1中的内容
   Next I
   Printer.EndDoc

End Sub

Private Sub Command6_Click()
    End
End Sub

Private Sub Form_Load()
    '设置可使用文件类型
    CommonDialog1.Filter = "我的文档文件|*.MDC|全部文件|*.*"
End Sub

Private Sub Form_Resize()
    '当窗体改变时修改文本框大小
    Text1.Top = 500
    Text1.Left = 100
    Text1.Width = Me.Width - 300
    Text1.Height = Me.Height - 1000
End Sub
