Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Componetes do Form
- 1 menustrip (guia arquivos - abrir, Salvar, Sair) (guia ferramentas - Fonte, Cor da Fonte, Cor de Fundo, Limpar Tudo)
- 1textbox
- '==================================================================================================================================
- Public Class Form1
- Private Sub AbrirToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AbrirToolStripMenuItem.Click
- Dim ler As String
- Dim open As New OpenFileDialog
- open.Title = "Abrir Arquivo de Texto"
- open.Filter = "Arquivo de Texto (*.txt)|*.txt"
- open.FileName = "*.txt"
- If open.ShowDialog = DialogResult.OK Then
- ler = My.Computer.FileSystem.ReadAllText(open.FileName)
- txt_Text.Text = ler
- Else
- End If
- End Sub
- Private Sub SalvarToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SalvarToolStripMenuItem.Click
- Dim save As New SaveFileDialog
- save.Title = "Salvar Arquivo de Texto"
- save.Filter = "ARquivo de Texto (*.txt)|*.txt"
- If save.ShowDialog = DialogResult.OK Then
- Dim file As System.IO.StreamWriter
- file = My.Computer.FileSystem.OpenTextFileWriter(save.FileName, True)
- file.WriteLine(txt_Text.Text)
- file.Close()
- Else
- End If
- End Sub
- Private Sub CorDaFonteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CorDaFonteToolStripMenuItem.Click
- Dim fonte As New FontDialog
- If fonte.ShowDialog = DialogResult.OK Then
- txt_Text.Font = fonte.Font
- End If
- End Sub
- Private Sub CorDeFundoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CorDeFundoToolStripMenuItem.Click
- Dim cor1 As New ColorDialog
- If cor1.ShowDialog = DialogResult.OK Then
- txt_Text.BackColor = cor1.Color
- End If
- End Sub
- Private Sub CorDaFonteToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles CorDaFonteToolStripMenuItem1.Click
- Dim cor2 As New ColorDialog
- If cor2.ShowDialog = DialogResult.OK Then
- txt_Text.ForeColor = cor2.Color
- End If
- End Sub
- Private Sub LimparTudoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LimparTudoToolStripMenuItem.Click
- txt_Text.Clear()
- End Sub
- End Class
Add Comment
Please, Sign In to add comment