Latihan Membuat MDI FORM
· Buatlah desain form seperti berikut ini :
:
Setelah itu Ubah Properti IsMDIContainer pada form 1 menjadi true
Gunakan Dock pada properties untuk memindahkan tempat standar bar dikiri, kanan, atas, tengah ataupun tidak diberi (None)
Lalu beri coding seperti di bawah ini :
Public Class Form1
Private Sub Tugas1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Tugas1ToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
Form2.Show()
Form3.Show()
End Sub
Private Sub Latihan1ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Latihan1ToolStripMenuItem.Click
Form2.MdiParent = Me
Form2.Show()
End Sub
Private Sub Latihan2ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Latihan2ToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.Cascade)
Form2.Show()
Form3.Show()
End Sub
Private Sub CascadeToolStripMenuItem_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles CascadeToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.Cascade)
Form2.Show()
Form3.Show()
End Sub
Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesTileHorizontalToolStripMenuItem.Click
Me.LayoutMdi(Windows.Forms.MdiLayout.TileHorizontal)
Form2.Show()
Form3.Show()
End Sub
Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles TileVerticalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileVertical)
Form2.Show()
Form3.Show()
End Sub
Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ToolStripMenuItem2.Click
Form2.MdiParent = Me
Form2.Show()
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ToolStripButton1.Click
Me.LayoutMdi(MdiLayout.TileVertical)
Form2.Show()
Form3.Show()
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ToolStripButton2.Click
Me.LayoutMdi(Windows.Forms.MdiLayout.TileHorizontal)
Form2.Show()
Form3.Show()
End Sub
End Class
Setelah itu
· Buatlah desain Form seperti ini untuk Form 2
Lalu beri coding seperti di bawah ini :
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
Me.MdiParent = Form1
End Sub
End Class
· Buatlah desain form seperti di bawah ini untuk Form 3
Lalu isikan coding di bawah ini pada form 3
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
Me.MdiParent = Form1
End Sub
End Class
Setelah semua selesai coba RUN program tersebut, dan hasilnya akan seperti ini . Jika pilih Cascade akan keluar hasil RUN seperti ini
· · Coba pilih Tile Horizontal dan hasil RUN akan seperti ini
Coba pilih Tile Vertical dan hasil RUN akan seperti ini
Tidak ada komentar:
Posting Komentar