VB编程 记事本
3个回答
展开全部
Me.CommonDialog1.ShowColor
Text1.Backcolor = Me.CommonDialog1.Color
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub Font_Click()
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
CommonDialog1.ShowFont
Text1.Font.Name = CommonDialog1.FontName
Text1.Font.Size = CommonDialog1.FontSize
Text1.Font.Bold = CommonDialog1.FontBold
Text1.Font.Italic = CommonDialog1.FontItalic
Text1.Font.Underline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.ForeColor = CommonDialog1.Color
Exit Sub
ErrHandler:
Exit Sub
End Sub
Private Sub Form_Resize()
Text1.Height = Form1.ScaleHeight
Text1.Width = Form1.ScaleWidth
End Sub
Private Sub Open_Click()
Text1.Text = ""
Me.CommonDialog1.Filter = "文档文件(*.txt)|*.txt|所有文件(*.*)|*.*"
Me.CommonDialog1.ShowOpen
Open Me.CommonDialog1.FileName For Input As #1
Text1.Text = StrConv(InputB$(LOF(1), 1), vbUnicode)
Close #1
End Sub
Private Sub Save_Click()
On Error Resume Next
Me.CommonDialog1.Filter = "文档文件(*.txt)|*.txt|所有文件(*.*)|*.*"
Me.CommonDialog1.ShowSave
Open Me.CommonDialog1.FileName For Output As #1
Print #1, Text1.Text
Close #1
End Sub
这么晚了,只能随便写一个,若有问题,你自己先解决吧!
Text1.Backcolor = Me.CommonDialog1.Color
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub Font_Click()
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
CommonDialog1.ShowFont
Text1.Font.Name = CommonDialog1.FontName
Text1.Font.Size = CommonDialog1.FontSize
Text1.Font.Bold = CommonDialog1.FontBold
Text1.Font.Italic = CommonDialog1.FontItalic
Text1.Font.Underline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.ForeColor = CommonDialog1.Color
Exit Sub
ErrHandler:
Exit Sub
End Sub
Private Sub Form_Resize()
Text1.Height = Form1.ScaleHeight
Text1.Width = Form1.ScaleWidth
End Sub
Private Sub Open_Click()
Text1.Text = ""
Me.CommonDialog1.Filter = "文档文件(*.txt)|*.txt|所有文件(*.*)|*.*"
Me.CommonDialog1.ShowOpen
Open Me.CommonDialog1.FileName For Input As #1
Text1.Text = StrConv(InputB$(LOF(1), 1), vbUnicode)
Close #1
End Sub
Private Sub Save_Click()
On Error Resume Next
Me.CommonDialog1.Filter = "文档文件(*.txt)|*.txt|所有文件(*.*)|*.*"
Me.CommonDialog1.ShowSave
Open Me.CommonDialog1.FileName For Output As #1
Print #1, Text1.Text
Close #1
End Sub
这么晚了,只能随便写一个,若有问题,你自己先解决吧!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询