본문 바로가기
Programing/vb.net

비쥬얼베이직(비주얼베이직)visual basic,vb.net 강좌-메모장만들기,FontDialog,ColorDialog,.AppendText

by 고니의 경제주식 2017. 1. 18.
반응형



기능확인하시고요..



이미지와 같이 콘트롤을 배치합니다..


Public Class Form1

' 폰트 FontDialog

    Private Sub 폰트ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 폰트ToolStripMenuItem.Click

        If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

            TextBox5.Font = FontDialog1.Font

        End If

    End Sub

  

   ' 색상 FontDialog

  Private Sub 색상ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 색상ToolStripMenuItem.Click

        If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

            TextBox5.ForeColor = ColorDialog1.Color

        End If

    End Sub

   '큰 TextBox 에 쓰기

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        TextBox5.AppendText(" " + vbNewLine) 

        TextBox5.AppendText(vbTab & Label1.Text + ":" + TextBox1.Text + vbNewLine)

        TextBox5.AppendText(vbTab & Label2.Text + ":" + TextBox2.Text + vbNewLine)

        TextBox5.AppendText(vbTab & Label3.Text + ":" + TextBox3.Text + vbNewLine)

        TextBox5.AppendText(vbTab & Label4.Text + ":" + TextBox4.Text + vbNewLine)

        TextBox5.AppendText(" " + vbNewLine)

        TextBox5.AppendText(vbTab & Today & vbTab & TimeOfDay + vbNewLine)

         ' vbTab  빈공간삽입,vbNewLine 한칸뛰우기


    End Sub

' 저장버튼

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Dim iSave As New SaveFileDialog

        iSave.Filter = "txt files (*.txt) | *.txt"

        iSave.FilterIndex = 2

        iSave.RestoreDirectory = False


        If iSave.ShowDialog() = Windows.Forms.DialogResult.OK Then

            IO.File.WriteAllText(iSave.FileName, TextBox5.Text)

        End If

    End Sub

  '나가기 버튼

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        Me.Close()

    End Sub


   

End Class


반응형