Jumat, 24 Oktober 2014

Contoh Penerapan “Properti Teks” dengan Visual Basic.Net 2010

VBNET2010LOGO

Contoh sederhana implementasi Properti Teks pada Visual Basic.Net 2010.

Seperti menerapkan Nama Font, Ukuran Font, Jenis Teks seperti Huruf Tebal, Huruf Kursif, Garis Bawah, Garis Coret, Letak Kalimat seperti Rata Kiri, Rata Tengah, Rata Kanan dan Warna Teks. Dengan menggunakan kontrol Text Box, Label, Button, Option Button, Check Box dan Combo Box untuk mengimplementasikan perintah kejadian pada program.

TeksPropertiVBNet

Kontrol Properti

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.Button2 = New System.Windows.Forms.Button()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.Button3 = New System.Windows.Forms.Button()
Me.GroupBox5 = New System.Windows.Forms.GroupBox()
Me.RadioButton8 = New System.Windows.Forms.RadioButton()
Me.RadioButton9 = New System.Windows.Forms.RadioButton()
Me.RadioButton10 = New System.Windows.Forms.RadioButton()
Me.ComboBox2 = New System.Windows.Forms.ComboBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.GroupBox4 = New System.Windows.Forms.GroupBox()
Me.CheckBox4 = New System.Windows.Forms.CheckBox()
Me.CheckBox3 = New System.Windows.Forms.CheckBox()
Me.CheckBox2 = New System.Windows.Forms.CheckBox()
Me.CheckBox1 = New System.Windows.Forms.CheckBox()
Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.RadioButton6 = New System.Windows.Forms.RadioButton()
Me.RadioButton5 = New System.Windows.Forms.RadioButton()
Me.RadioButton4 = New System.Windows.Forms.RadioButton()
Me.RadioButton3 = New System.Windows.Forms.RadioButton()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.RadioButton2 = New System.Windows.Forms.RadioButton()
Me.RadioButton1 = New System.Windows.Forms.RadioButton()
Me.GroupBox6 = New System.Windows.Forms.GroupBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.HScrollBar3 = New System.Windows.Forms.HScrollBar()
Me.HScrollBar2 = New System.Windows.Forms.HScrollBar()
Me.HScrollBar1 = New System.Windows.Forms.HScrollBar()
Me.ShapeContainer1 = New Microsoft.VisualBasic.PowerPacks.ShapeContainer()
Me.LineShape2 = New Microsoft.VisualBasic.PowerPacks.LineShape()
Me.LineShape1 = New Microsoft.VisualBasic.PowerPacks.LineShape()
Me.Button4 = New System.Windows.Forms.Button()
Me.GroupBox2.SuspendLayout()
Me.GroupBox5.SuspendLayout()
Me.GroupBox4.SuspendLayout()
Me.GroupBox3.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.GroupBox6.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 15)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(131, 17)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Tuliskan nama Anda :"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(149, 12)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(166, 25)
Me.TextBox1.TabIndex = 1
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(201, 40)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(114, 17)
Me.Label2.TabIndex = 2
Me.Label2.Text = "0 Karakter 0 Spasi"
'
'Button1
'
Me.Button1.Enabled = False
Me.Button1.Location = New System.Drawing.Point(15, 132)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(300, 29)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Salin"
Me.Button1.UseVisualStyleBackColor = True
'
'TextBox2
'
Me.TextBox2.BackColor = System.Drawing.SystemColors.Window
Me.TextBox2.Font = New System.Drawing.Font("Segoe UI", 27.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox2.ForeColor = System.Drawing.SystemColors.WindowText
Me.TextBox2.Location = New System.Drawing.Point(15, 69)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.ReadOnly = True
Me.TextBox2.Size = New System.Drawing.Size(300, 57)
Me.TextBox2.TabIndex = 4
Me.TextBox2.TabStop = False
'
'Button2
'
Me.Button2.Enabled = False
Me.Button2.Location = New System.Drawing.Point(12, 305)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(300, 29)
Me.Button2.TabIndex = 5
Me.Button2.Text = "Ubah Properti Teks >>>"
Me.Button2.UseVisualStyleBackColor = True
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.Button3)
Me.GroupBox2.Controls.Add(Me.GroupBox5)
Me.GroupBox2.Controls.Add(Me.ComboBox2)
Me.GroupBox2.Controls.Add(Me.Label4)
Me.GroupBox2.Controls.Add(Me.ComboBox1)
Me.GroupBox2.Controls.Add(Me.Label3)
Me.GroupBox2.Controls.Add(Me.GroupBox4)
Me.GroupBox2.Controls.Add(Me.GroupBox3)
Me.GroupBox2.Controls.Add(Me.GroupBox1)
Me.GroupBox2.Location = New System.Drawing.Point(332, 12)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(405, 322)
Me.GroupBox2.TabIndex = 7
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Pilihan:"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(279, 24)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(112, 58)
Me.Button3.TabIndex = 16
Me.Button3.Text = "Seting Ulang"
Me.Button3.UseVisualStyleBackColor = True
'
'GroupBox5
'
Me.GroupBox5.Controls.Add(Me.RadioButton8)
Me.GroupBox5.Controls.Add(Me.RadioButton9)
Me.GroupBox5.Controls.Add(Me.RadioButton10)
Me.GroupBox5.Location = New System.Drawing.Point(281, 166)
Me.GroupBox5.Name = "GroupBox5"
Me.GroupBox5.Size = New System.Drawing.Size(110, 141)
Me.GroupBox5.TabIndex = 15
Me.GroupBox5.TabStop = False
Me.GroupBox5.Text = "Rata Teks:"
'
'RadioButton8
'
Me.RadioButton8.AutoSize = True
Me.RadioButton8.Location = New System.Drawing.Point(25, 79)
Me.RadioButton8.Name = "RadioButton8"
Me.RadioButton8.Size = New System.Drawing.Size(56, 17)
Me.RadioButton8.TabIndex = 11
Me.RadioButton8.TabStop = True
Me.RadioButton8.Text = "Kanan"
Me.RadioButton8.UseVisualStyleBackColor = True
'
'RadioButton9
'
Me.RadioButton9.AutoSize = True
Me.RadioButton9.Location = New System.Drawing.Point(25, 52)
Me.RadioButton9.Name = "RadioButton9"
Me.RadioButton9.Size = New System.Drawing.Size(62, 17)
Me.RadioButton9.TabIndex = 10
Me.RadioButton9.TabStop = True
Me.RadioButton9.Text = "Tengah"
Me.RadioButton9.UseVisualStyleBackColor = True
'
'RadioButton10
'
Me.RadioButton10.AutoSize = True
Me.RadioButton10.Location = New System.Drawing.Point(25, 25)
Me.RadioButton10.Name = "RadioButton10"
Me.RadioButton10.Size = New System.Drawing.Size(39, 17)
Me.RadioButton10.TabIndex = 9
Me.RadioButton10.TabStop = True
Me.RadioButton10.Text = "Kiri"
Me.RadioButton10.UseVisualStyleBackColor = True
'
'ComboBox2
'
Me.ComboBox2.FormattingEnabled = True
Me.ComboBox2.Location = New System.Drawing.Point(100, 126)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(291, 25)
Me.ComboBox2.TabIndex = 14
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(13, 129)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(81, 17)
Me.Label4.TabIndex = 13
Me.Label4.Text = "Ukuran Font:"
'
'ComboBox1
'
Me.ComboBox1.FormattingEnabled = True
Me.ComboBox1.Location = New System.Drawing.Point(100, 95)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(291, 25)
Me.ComboBox1.TabIndex = 12
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(13, 97)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(75, 17)
Me.Label3.TabIndex = 11
Me.Label3.Text = "Nama Font:"
'
'GroupBox4
'
Me.GroupBox4.Controls.Add(Me.CheckBox4)
Me.GroupBox4.Controls.Add(Me.CheckBox3)
Me.GroupBox4.Controls.Add(Me.CheckBox2)
Me.GroupBox4.Controls.Add(Me.CheckBox1)
Me.GroupBox4.Location = New System.Drawing.Point(136, 166)
Me.GroupBox4.Name = "GroupBox4"
Me.GroupBox4.Size = New System.Drawing.Size(133, 141)
Me.GroupBox4.TabIndex = 10
Me.GroupBox4.TabStop = False
Me.GroupBox4.Text = "Jenis Teks:"
'
'CheckBox4
'
Me.CheckBox4.AutoSize = True
Me.CheckBox4.Location = New System.Drawing.Point(19, 107)
Me.CheckBox4.Name = "CheckBox4"
Me.CheckBox4.Size = New System.Drawing.Size(59, 21)
Me.CheckBox4.TabIndex = 12
Me.CheckBox4.Text = "Coret"
Me.CheckBox4.UseVisualStyleBackColor = True
'
'CheckBox3
'
Me.CheckBox3.AutoSize = True
Me.CheckBox3.Location = New System.Drawing.Point(19, 80)
Me.CheckBox3.Name = "CheckBox3"
Me.CheckBox3.Size = New System.Drawing.Size(98, 21)
Me.CheckBox3.TabIndex = 11
Me.CheckBox3.Text = "Garis Bawah"
Me.CheckBox3.UseVisualStyleBackColor = True
'
'CheckBox2
'
Me.CheckBox2.AutoSize = True
Me.CheckBox2.Location = New System.Drawing.Point(19, 53)
Me.CheckBox2.Name = "CheckBox2"
Me.CheckBox2.Size = New System.Drawing.Size(60, 21)
Me.CheckBox2.TabIndex = 10
Me.CheckBox2.Text = "Kursif"
Me.CheckBox2.UseVisualStyleBackColor = True
'
'CheckBox1
'
Me.CheckBox1.AutoSize = True
Me.CheckBox1.Location = New System.Drawing.Point(19, 26)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(59, 21)
Me.CheckBox1.TabIndex = 9
Me.CheckBox1.Text = "Tebal"
Me.CheckBox1.UseVisualStyleBackColor = True
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.RadioButton6)
Me.GroupBox3.Controls.Add(Me.RadioButton5)
Me.GroupBox3.Controls.Add(Me.RadioButton4)
Me.GroupBox3.Controls.Add(Me.RadioButton3)
Me.GroupBox3.Location = New System.Drawing.Point(16, 166)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(110, 141)
Me.GroupBox3.TabIndex = 9
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "Warna Teks:"
'
'RadioButton6
'
Me.RadioButton6.AutoSize = True
Me.RadioButton6.Location = New System.Drawing.Point(25, 106)
Me.RadioButton6.Name = "RadioButton6"
Me.RadioButton6.Size = New System.Drawing.Size(58, 17)
Me.RadioButton6.TabIndex = 12
Me.RadioButton6.TabStop = True
Me.RadioButton6.Text = "Kuning"
Me.RadioButton6.UseVisualStyleBackColor = True
'
'RadioButton5
'
Me.RadioButton5.AutoSize = True
Me.RadioButton5.Location = New System.Drawing.Point(25, 79)
Me.RadioButton5.Name = "RadioButton5"
Me.RadioButton5.Size = New System.Drawing.Size(49, 17)
Me.RadioButton5.TabIndex = 11
Me.RadioButton5.TabStop = True
Me.RadioButton5.Text = "Hijau"
Me.RadioButton5.UseVisualStyleBackColor = True
'
'RadioButton4
'
Me.RadioButton4.AutoSize = True
Me.RadioButton4.Location = New System.Drawing.Point(25, 52)
Me.RadioButton4.Name = "RadioButton4"
Me.RadioButton4.Size = New System.Drawing.Size(55, 17)
Me.RadioButton4.TabIndex = 10
Me.RadioButton4.TabStop = True
Me.RadioButton4.Text = "Merah"
Me.RadioButton4.UseVisualStyleBackColor = True
'
'RadioButton3
'
Me.RadioButton3.AutoSize = True
Me.RadioButton3.Location = New System.Drawing.Point(25, 25)
Me.RadioButton3.Name = "RadioButton3"
Me.RadioButton3.Size = New System.Drawing.Size(43, 17)
Me.RadioButton3.TabIndex = 9
Me.RadioButton3.TabStop = True
Me.RadioButton3.Text = "Biru"
Me.RadioButton3.UseVisualStyleBackColor = True
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.RadioButton2)
Me.GroupBox1.Controls.Add(Me.RadioButton1)
Me.GroupBox1.Location = New System.Drawing.Point(16, 24)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(253, 58)
Me.GroupBox1.TabIndex = 7
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Rubah Semua Karakter:"
'
'RadioButton2
'
Me.RadioButton2.AutoSize = True
Me.RadioButton2.Location = New System.Drawing.Point(143, 24)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(77, 17)
Me.RadioButton2.TabIndex = 9
Me.RadioButton2.TabStop = True
Me.RadioButton2.Text = "Huruf Kecil"
Me.RadioButton2.UseVisualStyleBackColor = True
'
'RadioButton1
'
Me.RadioButton1.AutoSize = True
Me.RadioButton1.Location = New System.Drawing.Point(25, 24)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(81, 17)
Me.RadioButton1.TabIndex = 8
Me.RadioButton1.TabStop = True
Me.RadioButton1.Text = "Huruf Besar"
Me.RadioButton1.UseVisualStyleBackColor = True
'
'GroupBox6
'
Me.GroupBox6.Controls.Add(Me.Label7)
Me.GroupBox6.Controls.Add(Me.Label6)
Me.GroupBox6.Controls.Add(Me.Label5)
Me.GroupBox6.Controls.Add(Me.HScrollBar3)
Me.GroupBox6.Controls.Add(Me.HScrollBar2)
Me.GroupBox6.Controls.Add(Me.HScrollBar1)
Me.GroupBox6.Location = New System.Drawing.Point(15, 167)
Me.GroupBox6.Name = "GroupBox6"
Me.GroupBox6.Size = New System.Drawing.Size(297, 124)
Me.GroupBox6.TabIndex = 8
Me.GroupBox6.TabStop = False
Me.GroupBox6.Text = "Warna Latar Belakang:"
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(252, 90)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(31, 17)
Me.Label7.TabIndex = 15
Me.Label7.Text = "0"
Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(252, 64)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(31, 17)
Me.Label6.TabIndex = 14
Me.Label6.Text = "0"
Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(252, 32)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(31, 17)
Me.Label5.TabIndex = 13
Me.Label5.Text = "0"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'HScrollBar3
'
Me.HScrollBar3.LargeChange = 30
Me.HScrollBar3.Location = New System.Drawing.Point(14, 91)
Me.HScrollBar3.Maximum = 255
Me.HScrollBar3.Name = "HScrollBar3"
Me.HScrollBar3.Size = New System.Drawing.Size(226, 21)
Me.HScrollBar3.TabIndex = 12
'
'HScrollBar2
'
Me.HScrollBar2.LargeChange = 30
Me.HScrollBar2.Location = New System.Drawing.Point(14, 60)
Me.HScrollBar2.Maximum = 255
Me.HScrollBar2.Name = "HScrollBar2"
Me.HScrollBar2.Size = New System.Drawing.Size(226, 21)
Me.HScrollBar2.TabIndex = 11
'
'HScrollBar1
'
Me.HScrollBar1.LargeChange = 30
Me.HScrollBar1.Location = New System.Drawing.Point(14, 28)
Me.HScrollBar1.Maximum = 255
Me.HScrollBar1.Name = "HScrollBar1"
Me.HScrollBar1.Size = New System.Drawing.Size(226, 21)
Me.HScrollBar1.TabIndex = 10
'
'ShapeContainer1
'
Me.ShapeContainer1.Location = New System.Drawing.Point(0, 0)
Me.ShapeContainer1.Margin = New System.Windows.Forms.Padding(0)
Me.ShapeContainer1.Name = "ShapeContainer1"
Me.ShapeContainer1.Shapes.AddRange(New Microsoft.VisualBasic.PowerPacks.Shape() {Me.LineShape2, Me.LineShape1})
Me.ShapeContainer1.Size = New System.Drawing.Size(750, 397)
Me.ShapeContainer1.TabIndex = 9
Me.ShapeContainer1.TabStop = False
'
'LineShape2
'
Me.LineShape2.BorderColor = System.Drawing.SystemColors.Window
Me.LineShape2.BorderWidth = 2
Me.LineShape2.Name = "LineShape2"
Me.LineShape2.X1 = -2
Me.LineShape2.X2 = 752
Me.LineShape2.Y1 = 349
Me.LineShape2.Y2 = 349
'
'LineShape1
'
Me.LineShape1.Name = "LineShape1"
Me.LineShape1.X1 = -2
Me.LineShape1.X2 = 752
Me.LineShape1.Y1 = 348
Me.LineShape1.Y2 = 348
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(613, 356)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(124, 29)
Me.Button4.TabIndex = 10
Me.Button4.Text = "K&eluar"
Me.Button4.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 17.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(750, 397)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.GroupBox6)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.ShapeContainer1)
Me.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Properti Teks"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox2.PerformLayout()
Me.GroupBox5.ResumeLayout(False)
Me.GroupBox5.PerformLayout()
Me.GroupBox4.ResumeLayout(False)
Me.GroupBox4.PerformLayout()
Me.GroupBox3.ResumeLayout(False)
Me.GroupBox3.PerformLayout()
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.GroupBox6.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox
Friend WithEvents CheckBox4 As System.Windows.Forms.CheckBox
Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox
Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton6 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents GroupBox5 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton8 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton9 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton10 As System.Windows.Forms.RadioButton
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents GroupBox6 As System.Windows.Forms.GroupBox
Friend WithEvents HScrollBar1 As System.Windows.Forms.HScrollBar
Friend WithEvents HScrollBar3 As System.Windows.Forms.HScrollBar
Friend WithEvents HScrollBar2 As System.Windows.Forms.HScrollBar
Friend WithEvents ShapeContainer1 As Microsoft.VisualBasic.PowerPacks.ShapeContainer
Friend WithEvents LineShape2 As Microsoft.VisualBasic.PowerPacks.LineShape
Friend WithEvents LineShape1 As Microsoft.VisualBasic.PowerPacks.LineShape
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label

End Class


Kode Sumber


Public Class Form1

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim Karakter As String

Karakter = "~`!@#$%^&*()-_+=[]{}:;'<>,.?/\|"
If (e.KeyChar >= ChrW(Keys.D0) And e.KeyChar <= ChrW(Keys.D9)) Then
Beep()
e.KeyChar = ChrW(0)
ElseIf InStr(1, Karakter, ChrW(AscW(e.KeyChar))) Then
Beep()
e.KeyChar = ChrW(0)
ElseIf e.KeyChar = ChrW(13) Then
Button1_Click(sender, New EventArgs)
End If
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim Masukan As Integer
Dim PosisiKarakter As Long
Dim InputKarakter As String
Dim InputSpasi As Integer

If Len(TextBox1.Text) > 0 Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If

Masukan = TextBox1.SelectionStart
TextBox1.Text = StrConv(TextBox1.Text, vbProperCase)
TextBox1.SelectionStart = Masukan

PosisiKarakter = 1
InputSpasi = 0
InputKarakter = TextBox1.Text
If InputKarakter = "" Then
Label2.Text = "0 Karakter 0 Spasi"
ElseIf Len(InputKarakter) > 0 Then
Do While PosisiKarakter > 0
PosisiKarakter = InStr(PosisiKarakter, InputKarakter, " ", )
If PosisiKarakter > 0 Then
While Mid(InputKarakter, PosisiKarakter, 1) = " "
PosisiKarakter = PosisiKarakter + 1
InputSpasi = InputSpasi + 1
End While
End If
Loop
Label2.Text = Len(TextBox1.Text) - InputSpasi & " Karakter " & InputSpasi & " Spasi"
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "Salin" Then
TextBox2.Text = TextBox1.Text
Button1.Text = "Baru"
Button1.Focus()
Else
TextBox1.Clear()
TextBox2.Clear()

'Dim Kontrol As Control
'For Each Kontrol In Me.Controls
' If TypeOf Kontrol Is TextBox Then Kontrol.Text = ""
' If TypeOf Kontrol Is GroupBox Then
' Dim Kontrol1 As Control
' For Each Kontrol1 In Kontrol.Controls
' If TypeOf Kontrol1 Is TextBox Then
' Kontrol1.Text = ""
' End If
' Next
' End If
'Next

Button1.Text = "Salin"
TextBox1.Focus()
End If
End Sub

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If MsgBox("Keluar program ?", vbYesNo + vbQuestion, "Confirmation") = vbNo Then
If e.CloseReason = CloseReason.UserClosing Then
e.Cancel = True
TextBox1.Focus()
End If
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button2.Text = "Ubah Properti Teks >>>" Then
Me.Width = 756
Me.CenterToScreen()
ComboBox1.SelectedIndex = 0
ComboBox2.SelectedIndex = 3
RadioButton10.Checked = True
Button2.Text = "<<< Sembunyikan Properti Teks"
Button4.Location = New Point(613, 359)
TextBox1.Focus()
Else
Me.Width = 335
Me.CenterToScreen()
Button2.Text = "Ubah Properti Teks >>>"
Button4.Location = New Point(191, 356)
TextBox1.Focus()
End If
End Sub

Private Sub RadioButton1_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
TextBox2.Text = UCase(TextBox2.Text)
End Sub

Private Sub RadioButton2_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
TextBox2.Text = LCase(TextBox2.Text)
End Sub

Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Me.BackColor = Color.FromArgb(HScrollBar1.Value, HScrollBar2.Value, HScrollBar3.Value)
Label5.Text = HScrollBar1.Value
End Sub

Private Sub HScrollBar2_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar2.Scroll
Me.BackColor = Color.FromArgb(HScrollBar1.Value, HScrollBar2.Value, HScrollBar3.Value)
Label6.Text = HScrollBar2.Value
End Sub

Private Sub HScrollBar3_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar3.Scroll
Me.BackColor = Color.FromArgb(HScrollBar1.Value, HScrollBar2.Value, HScrollBar3.Value)
Label7.Text = HScrollBar3.Value
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Width = 335
Me.CenterToScreen()
Button4.Location = New Point(191, 356)

Dim NamaFont As FontFamily

For Each NamaFont In System.Drawing.FontFamily.Families
ComboBox1.Items.Add(NamaFont.Name)
Next

Dim i%

For i = 20 To 28 Step 2
ComboBox2.Items.Add(i)
Next
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
RadioButton1.Checked = False
RadioButton2.Checked = False
RadioButton3.Checked = False
RadioButton4.Checked = False
RadioButton5.Checked = False
RadioButton6.Checked = False
RadioButton8.Checked = False
RadioButton9.Checked = False
RadioButton10.Checked = True
ComboBox1.SelectedIndex = 0
ComboBox2.SelectedIndex = 3
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
TextBox2.ForeColor = SystemColors.WindowText
End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
If Len(TextBox2.Text) > 0 Then
Button2.Enabled = True
Else
Button2.Enabled = False
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Close()
End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
TextBox2.ForeColor = Color.Blue
End Sub

Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
TextBox2.ForeColor = Color.Red
End Sub

Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
TextBox2.ForeColor = Color.Green
End Sub

Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
TextBox2.ForeColor = Color.Yellow
End Sub

Private Sub RadioButton10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton10.CheckedChanged
TextBox2.TextAlign = HorizontalAlignment.Left
End Sub

Private Sub RadioButton9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton9.CheckedChanged
TextBox2.TextAlign = HorizontalAlignment.Center
End Sub

Private Sub RadioButton8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton8.CheckedChanged
TextBox2.TextAlign = HorizontalAlignment.Right
End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.CheckState = CheckState.Checked Then
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style Or FontStyle.Bold)
Else
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style And Not FontStyle.Bold)
End If
End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.CheckState = CheckState.Checked Then
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style Or FontStyle.Italic)
Else
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style And Not FontStyle.Italic)
End If
End Sub

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.CheckState = CheckState.Checked Then
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style Or FontStyle.Underline)
Else
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style And Not FontStyle.Underline)
End If
End Sub

Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
If CheckBox4.CheckState = CheckState.Checked Then
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style Or FontStyle.Strikeout)
Else
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style And Not FontStyle.Strikeout)
End If
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox2.Font = New Font(ComboBox1.Text, 28, FontStyle.Regular)
End Sub

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Dim UkuranFont As Integer
UkuranFont = Val(ComboBox2.Text)
TextBox2.Font = New Font(ComboBox1.Text, UkuranFont, FontStyle.Regular)
End Sub

End Class


Unduh Kode Sumber

Label:

0 Komentar:

Posting Komentar

Berlangganan Posting Komentar [Atom]

<< Beranda