Saturday, 31 January 2015

Visual Basic 6.0 Graphics

In Visual Basic 6.0, various graphics methods and properties are used to draw on a Form or PictureBox control. Graphics in Visual Basic 6.0 are based on the Windows Graphics Device Interface (GDI) APIs.

Drawing Hut Using Line (VB6.0)



Private Sub Command1_Click()
   
    Me.Line (5000, 9000)-(5000, 5500)
    Me.Line (5000, 5500)-(6500, 3500)
    Me.Line (6500, 3500)-(8200, 5700)
    Me.Line (8000, 9000)-(8000, 5500)
    Me.Line (6500, 3500)-(15000, 4000)
    Me.Line (15000, 4000)-(16000, 5000)
    Me.Line (8200, 5700)-(16000, 5000)
    Me.Line (15500, 5050)-(15500, 7500)
    Me.Line (15500, 7500)-(8000, 9000)
    Me.Line (8000, 9000)-(5000, 9000)
    'window
    Me.Line (14000, 5500)-(14000, 7000)
    Me.Line (14000, 7000)-(10000, 7650)
    Me.Line (14000, 5500)-(10000, 6000)
    'door
    Me.Line (5500, 9000)-(5500, 6000)
    Me.Line (5500, 6000)-(7400, 6000)
    Me.Line (7400, 6000)-(7400, 9000)
    Me.Line (10000, 6000)-(10000, 7650)  
    
End Sub


Different Graphics using Line (VB6.0)

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)

    Me.Circle (X, Y), Y
 
End Sub

No comments:

Post a Comment