Jumat, 15 April 2011

Grafika Komputer (Menggambar Objek Menggunakan Visual Basic)

Berikut adalah listing program untuk membuat Gambar dalam visual basic.

Private Sub Command1_Click()
Shape1.Visible = False
Line1.X1 = Text1.Text
Line1.X2 = Text2.Text
Line1.Y1 = Text3.Text
Line1.Y2 = Text4.Text
Line1.Visible = True
End Sub

Private Sub Command2_Click()
Line1.Visible = False
Shape1.Left = Text1.Text
Shape1.Width = Text2.Text
Shape1.Top = Text3.Text
Shape1.Height = Text4.Text
Shape1.Shape = 0
Shape1.Visible = True
End Sub

Private Sub Command3_Click()
Line1.Visible = False
Shape1.Left = Text1.Text
Shape1.Width = Text2.Text
Shape1.Top = Text3.Text
Shape1.Height = Text4.Text
Shape1.Shape = 3
Shape1.Visible = True
End Sub

Private Sub Command4_Click()
Line1.Visible = False
Shape1.Left = Text1.Text
Shape1.Width = Text2.Text
Shape1.Top = Text3.Text
Shape1.Height = Text4.Text
Shape1.Shape = 2
Shape1.Visible = True
End Sub

Private Sub Form_Load()
Line1.Visible = False
Shape1.Visible = False
End Sub

Dan Berikut adalah captured screen dari program yang berjalan.

-Membuat Garis :

-Membuat Kotak :

-Membuat Lingkaran :

-Membuat Oval :