Private Sub 開啟OToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 開啟OToolStripMenuItem.Click
If OpenFileDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName, _
System.Text.Encoding.Default)
End If
End Sub
Private Sub 另存新檔AToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 另存新檔AToolStripMenuItem.Click
If SaveFileDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text, False)
End If
End Sub
Private Sub 新增NToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 新增NToolStripMenuItem.Click
OpenFileDialog1.FileName = Nothing
TextBox1.Clear()
End Sub
Private Sub 儲存SToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 儲存SToolStripMenuItem.Click
If OpenFileDialog1.FileName = Nothing Then
If SaveFileDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text, False)
End If
Else
My.Computer.FileSystem.WriteAllText(OpenFileDialog1.FileName, TextBox1.Text, False)
End If
End Sub
Private Sub 結束XToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 結束XToolStripMenuItem.Click
Application.Exit()
End Sub
Private Sub 剪下TToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 剪下TToolStripMenuItem.Click
TextBox1.Cut()
End Sub
Private Sub 複製CToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 複製CToolStripMenuItem.Click
TextBox1.Copy()
End Sub
Private Sub 貼上PToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 貼上PToolStripMenuItem.Click
TextBox1.Paste()
End Sub
Private Sub 全選AToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 全選AToolStripMenuItem.Click
TextBox1.SelectAll()
End Sub
Private Sub 搜尋取代ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 搜尋取代ToolStripMenuItem1.Click
GroupBox1.Visible = True
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button3.Click
GroupBox1.Visible = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Dim P As Integer
If TextBox1.SelectionStart > 0 Then
P = TextBox1.Text.IndexOf(TextBox2.Text, TextBox1.SelectionStart + 1)
Else
P = TextBox1.Text.IndexOf(TextBox2.Text, TextBox1.SelectionStart)
End If
If P < 0 Then
MsgBox("未發現搜尋字串!")
Else
TextBox1.SelectionStart = P
TextBox1.SelectionLength = TextBox2.TextLength
TextBox1.Select()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button2.Click
TextBox1.SelectedText = TextBox3.Text
End Sub
Dim mdx As Integer, mdy As Integer
Private Sub GroupBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles GroupBox1.MouseDown
mdx = e.X
mdy = e.Y
End Sub
Private Sub GroupBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles GroupBox1.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
GroupBox1.Left += e.X - mdx
GroupBox1.Top = e.Y - mdy
End If
End Sub
Private Sub 字型CToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 字型CToolStripMenuItem.Click
FontDialog1.ShowDialog()
TextBox1.Font = FontDialog1.Font
End Sub
Private Sub 顏色OToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles 顏色OToolStripMenuItem.Click
ColorDialog1.ShowDialog()
TextBox1.ForeColor = ColorDialog1.Color
End Sub
End Class
沒有留言:
張貼留言