|
KodKod Sumber Notepad |
| Public ACTfilename, leveldata As String Public saved As Boolean Dim msg As Variant Private Sub Form_Resize() Text1.Width = Form1.Width - 100 Text1.Height = Form1.Height - 700 End Sub Private Sub Form_Unload(cancel As Integer) If ACTfilename <> "" Then If saved = False Then msg = MsgBox("Save changes to " & ACTfilename & " Befor closing?", vbYesNoCancel + vbExclamation, "Oren's lame notepad") Else If saved = False Then msg = MsgBox("Save changes to 'Untitled' Befor closing?", vbYesNoCancel + vbExclamation, "Oren's lame notepad") End If If saved = True Then End If msg = vbYes Then Call MNUSave_Click If msg = vbCancel Then cancel = True If msg = vbNo Then End End Sub Private Sub MNUexit_Click() Call Form_Unload(0) ' will check if the user saved the document since the last change, if not, it will worn him End Sub Private Sub MNUfont_Click() form2.Show form2.Text1.Text = Text1.FontSize End Sub Private Sub MNUnew_Click() Text1.Text = "" End Sub Private Sub MNUopen_Click() Dim space As String space = (Chr$(13)) + (Chr$(10)) Call MNUnew_Click CommonDialog1.Filter = "Text file (*.txt)|*.txt|" CommonDialog1.ShowOpen CommonDialog1.DialogTitle = "Open File..." ACTfilename = Form1.CommonDialog1.FileName Form1.Caption = "Oren's lame notepad" & " " & [ACTfilename] Close #99 If ACTfilename <> "" Then Open ACTfilename For Input As #99 Do Until EOF(99) Line Input #99, row Text1.Text = Text1.Text + row & space Loop End If saved = True End Sub Private Sub MNUSave_Click() saved = True leveldata = Text1.Text If ACTfilename = "" Then Call MNUSaveas_Click ' incase there isn't already a name for the file, the user will now choose one Close #99 Open Mid(ACTfilename, 1, Len(ACTfilename)) For Binary As #99 Put #99, , leveldata Close #99 End Sub Private Sub MNUSaveas_Click() CommonDialog1.Filter = "Text file (*.txt)|*.txt" CommonDialog1.DialogTitle = "Save as..." CommonDialog1.ShowSave ACTfilename = CommonDialog1.FileName Call MNUSave_Click Form1.Caption = "Oren's lame notepad" & " " & [ACTfilename] End Sub Private Sub Text1_Change() saved = False End Sub |
|
Design by myus1119 |