membuat form berubah menggunakan VB.NET….

**** Langsung aja copy paste kan code dibawah ini dan jgn lupa di Compile…..

Imports System.Drawing.Drawing2D
Public Class Form1
Inherits System.Windows.Forms.Form
Dim play As Integer
Dim p As New Point
#Region ” Windows Form Designer generated code ”

Public Sub elips()
Dim GrPath As New GraphicsPath
GrPath.AddEllipse(New Rectangle(40, 20, 420, 350))
MyBase.Region = New Region(GrPath)
End Sub
Public Sub segitiga()
Dim a As Point() = {New Point(50, 240), New Point(250, 30), New Point(430, 240)}
Dim lip As New GraphicsPath
lip.AddPolygon(a)
MyBase.Region = New Region(lip)
End Sub
Public Sub jajargenjang()
Dim a As Point() = {New Point(80, 80), New Point(120, 30), New Point(250, 30), New Point(210, 80), New Point(160, 120), New Point(30, 120)}
Dim lip As New GraphicsPath
lip.AddPolygon(a)
MyBase.Region = New Region(lip)
End Sub
Public Sub belaketupat()
Dim a As Point() = {New Point(50, 180), New Point(250, 20), New Point(430, 180), New Point(50, 180), New Point(250, 340), New Point(430, 180)}
Dim lip As New GraphicsPath
lip.AddPolygon(a)
MyBase.Region = New Region(lip)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.BackColor = BackColor.Blue
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Refresh()
Call elips()
Me.Height = 600
Me.Width = 600
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Refresh()
Call segitiga()
Me.Height = 600
Me.Width = 600
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Refresh()
Call belaketupat()
Me.Height = 600
Me.Width = 600
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If Button5.Text = “play” Then
Timer1.Enabled = True
Button5.Text = “stop”
ElseIf Button5.Text = “stop” Then
Timer1.Enabled = False
Button5.Text = “play”
End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
play = play + 1
If play = 5 Then
Call elips()
ElseIf play = 10 Then
Call segitiga()
ElseIf play = 15 Then
Call belaketupat()
ElseIf play = 20 Then
Call jajargenjang()
play = 0
End If
Me.Height = 600
Me.Width = 600
End Sub

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
p = New Point(-e.X, -e.Y)
End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If e.Button = MouseButtons.Left Then
Dim MousePos As Point = Control.MousePosition
MousePos.Offset(p.X, p.Y)
Location = MousePos
End If
End Sub

end class

One Response

  1. a5RPjK comment4 ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: