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 40602154"
- PictureBox1.Top = 0 : PictureBox1.Left = 0
- PictureBox1.Width = 480 : PictureBox1.Height = 280
- 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 myGraph As Graphics = PictureBox1.CreateGraphics
- Dim myPen1, myPen2 As Pen
- Dim mybrush As Brush
- Dim id, a, b, x, y, width As Integer
- myPen1 = New Pen(Color.Red, 5)
- myPen2 = New Pen(Color.Orange, 3)
- mybrush = New SolidBrush(Color.Orange)
- myGraph.DrawRectangle(myPen1, 0, 0, 480, 280)
- b = 20
- For id = 1 To 10
- a = 40
- x = (b * id) + 20
- y = b * (id - 1)
- width = 400 - ((id - 1) * a)
- myGraph.DrawRectangle(myPen2, x, y, width, b)
- myGraph.FillRectangle(mybrush, x, y, width, b)
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement