Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Public Class frmWord
- Dim pressed As Integer = 1
- Dim openedFile As String = ""
- Private Sub SaveToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveToolStripMenuItem.Click
- Dim SFD As New SaveFileDialog
- SFD.Title = "phOS Save .txt File"
- Dim SV As String
- SFD.Filter = "(*.txt)|*.txt"
- If openedFile <> Nothing Then
- SFD.FileName = openedFile
- End If
- SFD.ShowDialog()
- SV = SFD.FileName
- If RichTextBox1.Text <> Nothing And SV <> Nothing Then
- Dim sw As New StreamWriter(SV)
- sw.Write(RichTextBox1.Text)
- sw.Close()
- openedFile = SV
- MsgBox("File saved to " & SV, MsgBoxStyle.Information, "Success")
- End If
- End Sub
- Private Sub ArialToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ArialToolStripMenuItem.Click
- RichTextBox1.Font = New Font("Arial", 11)
- End Sub
- Private Sub ImpactToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ImpactToolStripMenuItem.Click
- RichTextBox1.Font = New Font("Impact", 11)
- End Sub
- Private Sub LucidiaToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles LucidiaToolStripMenuItem.Click
- RichTextBox1.Font = New Font("Lucida Console", 11)
- End Sub
- Private Sub DefaultToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles DefaultToolStripMenuItem.Click
- RichTextBox1.Font = New Font("Microsoft Sans Serif", 11)
- End Sub
- Private Sub ToolStripMenuItem2_Click(sender As System.Object, e As System.EventArgs)
- RichTextBox1.Font = New Font(RichTextBox1.Font, 11)
- End Sub
- Private Sub MinusToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs)
- RichTextBox1.Font = New Font(RichTextBox1.Font, 11)
- End Sub
- Private Sub OpenToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenToolStripMenuItem.Click
- Dim ofd As New OpenFileDialog
- ofd.Title = "phOS Open .txt File"
- ofd.Filter = "(*.txt)|*.txt"
- Dim fl As String
- ofd.ShowDialog()
- fl = ofd.FileName
- If fl <> Nothing Then
- Dim sr As New StreamReader(fl)
- RichTextBox1.Text = sr.ReadToEnd
- sr.Close()
- openedFile = fl
- End If
- End Sub
- Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
- Dim myform As frmWord = New frmWord
- myform.Show()
- End Sub
- Private Sub frmWord_Activated(sender As Object, e As System.EventArgs) Handles Me.Activated
- frmMain.pbNotes.BackColor = Color.Gray
- End Sub
- Private Sub frmWord_Deactivate(sender As Object, e As System.EventArgs) Handles Me.Deactivate
- frmMain.pbNotes.BackColor = Color.LightGray
- End Sub
- Private Sub frmWord_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- frmMain.pbNotes.Hide()
- frmMain.PictureBox12.Enabled = True
- For Each p In frmMain.picArrayNotes
- If p.Location.X > frmMain.pbNotes.Location.X Then
- p.Left -= 125
- ElseIf frmMain.pbNotes.Location = New Point(107, 980) Then
- p.Left -= 125
- End If
- Next
- End Sub
- Private Sub frmWord_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
- chkPin.Hide()
- PictureBox1.Hide()
- lblDisplay.Hide()
- frmMain.pbNotes.Show()
- End Sub
- Private Sub WordCountToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles WordCountToolStripMenuItem1.Click
- If lblDisplay.Text = Nothing Then
- lblDisplay.Text = "Total Chars: 0" & vbNewLine & "Total Words: 0"
- End If
- pressed += 1
- If ((pressed Mod 2) = 0) Then
- PictureBox1.Show()
- lblDisplay.Show()
- chkPin.Show()
- Else
- PictureBox1.Hide()
- lblDisplay.Hide()
- chkPin.Hide()
- End If
- End Sub
- Private Sub RichTextBox1_Click(sender As Object, e As System.EventArgs) Handles RichTextBox1.Click
- If lblDisplay.Visible = True And chkPin.Checked = False Then
- pressed += 1
- PictureBox1.Hide()
- lblDisplay.Hide()
- chkPin.Hide()
- End If
- End Sub
- Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles RichTextBox1.TextChanged
- Dim wordCount As String
- Dim counter As Integer
- wordCount = RichTextBox1.Text
- For Each a As Char In wordCount.Split(" ")
- If RichTextBox1.Text <> Nothing Then
- counter += 1
- End If
- Next
- Dim counter2 As Integer
- For Each a In RichTextBox1.Text
- If a <> " " Then
- counter2 += 1
- End If
- Next
- lblDisplay.Text = "Total Chars: " & counter2 & vbNewLine & "Total Words: " & counter
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement