帮帮忙阿:我做的简单编辑器所修饰的文本格式怎么才能保存下来呢 一下是我的代码 Private Sub Check1_Click(Index As Integer) Select Case Index Case 1 Text1.FontBold = Check1(1).Value Case 2 Text1.FontItalic = Check1(2).Value End Select
End Sub
Private Sub Command1_Click(Index As Integer) file_Click (Index) End Sub
Private Sub edi_Click(Index As Integer) i = Index Select Case i Case 0 Clipboard.SetText Text1.SelText Text1.SelText = "" Case 1 Clipboard.SetText Text1.SelText Case 2 Text1.SelText = Clipboard.GetText() Case 3 Text1.SelText = "" End Select End Sub
Private Sub file_Click(Index As Integer) i = Index Select Case i Case 0 Text1.Text = "" Form1.Caption = "未命名" Case 1 cd1.ShowOpen fname = cd1.FileName If fname <> "" Then Text1.Text = "" Open fname For Input As #1 b = "" Do Until EOF(1) Line Input #1, nextline b = b & nextline & Chr(13) & Chr(10) Loop Close #1 Text1.Text = b End If Form1.Caption = fname Case 2 If Form1.Caption = "未命名" Or Form1.Caption = "" Then cd1.ShowSave fname = cd1.FileName Else fname = Form1.Caption End If If fname <> "" Then Open fname For Output As #1 Print #1, Text1.Text Close #1 End If Case 3 cd1.ShowSave fname = cd1.FileName If fname <> "" Then Open fname For Output As #1 Print #1, Text1.Text Close #1 End If Case 4 End End Select End Sub
Private Sub Form_Resize() With Text1 .Top = Picture1.Height .Left = 0 .Height = Form1.ScaleHeight - Picture1.Height .Width = Form1.ScaleWidth End With End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer) edi(0).Visible = IIf(Text1.SelLength = 0, False, True) edi(1).Visible = IIf(Text1.SelLength = 0, False, True) edi(3).Visible = IIf(Text1.SelLength = 0, False, True)
End Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) edi(0).Visible = IIf(Text1.SelLength = 0, False, True) edi(1).Visible = IIf(Text1.SelLength = 0, False, True) edi(3).Visible = IIf(Text1.SelLength = 0, False, True) End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
n = Button.Index Select Case n Case 2, 3, 4 file_Click (n - 1) Case 5 Text1.FontBold = Button.Value Case 6 Text1.FontItalic = Button.Value End Select End Sub