Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Me.AutoSize = True : Me.Text = "Graph by 40602146"
- PictureBox1.Top = 0 : PictureBox1.Left = 0
- PictureBox1.Width = 505 : PictureBox1.Height = 505
- Button1.Text = "Draw" : Button1.Font = New Font("Courier", 20)
- Button1.Width = 100 : Button1.Height = 50
- Button1.Top = 10 : Button1.Left = PictureBox1.Width + 50
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim myGraphics As Graphics = PictureBox1.CreateGraphics
- Dim myPen1, myPen2 As Pen
- Dim id, x, y, w, h As Integer
- myPen1 = New Pen(Color.Blue, 5)
- myPen2 = New Pen(Color.Gray, 50)
- myGraphics.DrawRectangle(myPen1, 0, 0, 505, 505)
- For id = 1 To 5
- x = (id - 1) * 100 + 2.5 : y = 25 + 2.5 : w = 50 + ((id - 1) * 100) + 2.5 : h = y
- myGraphics.DrawLine(myPen2, x, y, w, h)
- myGraphics.DrawLine(myPen2, x, y + 100, w, h + 100)
- myGraphics.DrawLine(myPen2, x, y + 200, w, h + 200)
- myGraphics.DrawLine(myPen2, x, y + 300, w, h + 300)
- myGraphics.DrawLine(myPen2, x, y + 400, w, h + 400)
- Next
- For id = 1 To 5
- x = 50 + ((id - 1) * 100) + 2.5 : y = 75 + 2.5 : w = 100 + ((id - 1) * 100) + 2.5 : h = y
- myGraphics.DrawLine(myPen2, x, y, w, h)
- myGraphics.DrawLine(myPen2, x, y + 100, w, h + 100)
- myGraphics.DrawLine(myPen2, x, y + 200, w, h + 200)
- myGraphics.DrawLine(myPen2, x, y + 300, w, h + 300)
- myGraphics.DrawLine(myPen2, x, y + 400, w, h + 400)
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement