-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.vb
More file actions
139 lines (98 loc) · 4.24 KB
/
Form1.vb
File metadata and controls
139 lines (98 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
Imports System.IO
Imports System.Windows.Forms
Imports System.Drawing.Color
Public Class Form1
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs)
End Sub
Private Sub OpenToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles OpenToolStripMenuItem1.Click
With OpenFileDialog1
.Title = "Open File"
.Filter = "Text Files | *.txt"
.FileName = ""
.CheckFileExists = vbTrue
End With
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.LoadFile(OpenFileDialog1.FileName,
RichTextBoxStreamType.PlainText)
End If
End Sub
Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveToolStripMenuItem.Click
With SaveFileDialog1
.Title = "Save File"
.Filter = "Text Files | *.txt"
.DefaultExt = ".txt"
.OverwritePrompt = True
End With
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.SaveFile(SaveFileDialog1.FileName,
RichTextBoxStreamType.PlainText)
End If
End Sub
Private Sub SaveAsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveAsToolStripMenuItem.Click
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
SaveToolStripMenuItem_Click(sender, e)
End If
End Sub
Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontToolStripMenuItem.Click
If FontDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.Font = FontDialog1.Font
End If
End Sub
Private Sub FontColorToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontColorToolStripMenuItem.Click
If ColorDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.ForeColor = ColorDialog1.Color
End If
End Sub
Private Sub ProgramInformationToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ProgramInformationToolStripMenuItem.Click
AboutBox1.ShowDialog()
'When Program Information Button clicks it calls the built in AboutBox1.ShowDialog() method as if the user clicked the About button.
End Sub
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
End Sub
Private Sub FindToolStripMenuItem_Click(sender As Object, e As EventArgs)
End Sub
Private Sub WordWrapToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles WordWrapToolStripMenuItem.Click
If WordWrapToolStripMenuItem.CheckState = CheckState.Checked Then
RichTextBox1.WordWrap = True
End If
If WordWrapToolStripMenuItem.CheckState = CheckState.Unchecked Then
RichTextBox1.WordWrap = False
End If
End Sub
Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem1.Click
If ToolStripMenuItem1.CheckState = CheckState.Checked Then
ToolStripMenuItem2.CheckState = CheckState.Unchecked
ToolStripMenuItem3.CheckState = CheckState.Unchecked
DefaultToolStripMenuItem.CheckState = CheckState.Unchecked
RichTextBox1.ForeColor = Black
RichTextBox1.BackColor = Linen
End If
End Sub
Private Sub ToolStripMenuItem2_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem2.Click
If ToolStripMenuItem2.CheckState = CheckState.Checked Then
ToolStripMenuItem1.CheckState = CheckState.Unchecked
ToolStripMenuItem3.CheckState = CheckState.Unchecked
DefaultToolStripMenuItem.CheckState = CheckState.Unchecked
RichTextBox1.ForeColor = Black
RichTextBox1.BackColor = LightCoral
End If
End Sub
Private Sub ToolStripMenuItem3_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem3.Click
If ToolStripMenuItem3.CheckState = CheckState.Checked Then
ToolStripMenuItem2.CheckState = CheckState.Unchecked
ToolStripMenuItem1.CheckState = CheckState.Unchecked
DefaultToolStripMenuItem.CheckState = CheckState.Unchecked
RichTextBox1.ForeColor = Black
RichTextBox1.BackColor = LightGray
End If
End Sub
Private Sub DefaultToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DefaultToolStripMenuItem.Click
If DefaultToolStripMenuItem.CheckState = CheckState.Checked Then
ToolStripMenuItem3.CheckState = CheckState.Unchecked
ToolStripMenuItem2.CheckState = CheckState.Unchecked
ToolStripMenuItem1.CheckState = CheckState.Unchecked
RichTextBox1.ForeColor = Black
RichTextBox1.BackColor = White
End If
End Sub
End Class