Pages

Tuesday, 29 March 2016

Graphics : Draw Hut Using VB.Net


 Dim myPen As New System.Drawing.Pen(System.Drawing.Color.White)
        Dim formGraphics As System.Drawing.Graphics
        formGraphics = Me.CreateGraphics()
        formGraphics.DrawLine(myPen, 300, 135, 800, 175)
        formGraphics.DrawLine(myPen, 300, 135, 175, 300)
        formGraphics.DrawLine(myPen, 300, 135, 400, 300)

        formGraphics.DrawLine(myPen, 400, 300, 900, 300)
        formGraphics.DrawLine(myPen, 900, 300, 800, 175)
        formGraphics.DrawLine(myPen, 390, 285, 390, 600)
        formGraphics.DrawLine(myPen, 390, 600, 885, 475)
        formGraphics.DrawLine(myPen, 885, 475, 880, 300)
        formGraphics.DrawLine(myPen, 185, 300, 185, 600)
        formGraphics.DrawLine(myPen, 175, 300, 185, 300)
        formGraphics.DrawLine(myPen, 185, 600, 390, 600)
        formGraphics.DrawLine(myPen, 360, 600, 360, 360)
        formGraphics.DrawLine(myPen, 360, 360, 220, 360)
        formGraphics.DrawLine(myPen, 220, 360, 220, 600)
        formGraphics.DrawLine(myPen, 500, 350, 800, 340)
        formGraphics.DrawLine(myPen, 800, 340, 800, 450)
        formGraphics.DrawLine(myPen, 800, 450, 500, 520)
        formGraphics.DrawLine(myPen, 500, 520, 500, 350)
     

        myPen.Dispose()
        formGraphics.Dispose()

Line and Circle


Dim pp As New Pen(Color.FromArgb(Rnd() * 255, Rnd() * 255, Rnd() * 255), Int(Rnd() * 10))
        formGraphics.DrawEllipse(pp, e.X, e.Y, 100, 100)
        formGraphics.DrawLine(pp, e.X, e.Y, 100, 100)

Next Topic

No comments:

Post a Comment