Advertisement
Guest User

contoh no 1 di balik

a guest
Jun 15th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.         Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  4.             Me.AutoSize = True : Me.Text = "Graph by Your ID"
  5.             PictureBox1.Top = 0 : PictureBox1.Left = 0
  6.             PictureBox1.Width = 500 : PictureBox1.Height = 500
  7.             Button1.Text = "Draw" : Button1.Font = New Font("Courier", 20)
  8.             Button1.Width = 115 : Button1.Height = 50
  9.             Button1.Top = 10 : Button1.Left = PictureBox1.Width + 50
  10.         End Sub
  11.  
  12.         Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
  13.             Dim myGraph As Graphics = PictureBox1.CreateGraphics
  14.             Dim myPen1, myPen2 As Pen
  15.         Dim id, x1, y1, x2, y2, width, height As Integer
  16.             Dim mybrush As Brush
  17.  
  18.             myPen1 = New Pen(Color.Blue, 6)
  19.             myPen2 = New Pen(Color.DarkMagenta, 3)
  20.             mybrush = New SolidBrush(Color.DarkMagenta)
  21.             myGraph.DrawRectangle(myPen1, 0, 0, 500, 500)
  22.             For id = 1 To 9
  23.                 x1 = id * 50 : y1 = (id - 1) * 50
  24.             x2 = x1 : y2 = y1 + 50
  25.             width = 500 - x1
  26.                 Height = 50
  27.  
  28.                 myGraph.DrawRectangle(myPen2, x1, y1, Width, Height)
  29.                 myGraph.FillRectangle(mybrush, x1, y1, Width, Height)
  30.  
  31.             Next
  32.  
  33.         End Sub
  34.     End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement