TUGAS MEMBUAT MDI FORM
Langkah-Langkah :
1. Buka
Microsoft Visual Basic dan pilih new project lalu diberi nama Latihan MDI Form
2. Toolbox
yang digunakan:
- Menu stript
-ToolStript
-RibbonControl (sebelumnya harus
menginstal Developer Express)
-ContextMenuStript
-5 buah form :
-form1
-form2 (Latihan 1)
-form3 (Latihan 2)
-form4 (Latihan 3)
-form5 (Latihan 4)
Catatan
: form 2 – 5 yang akan dijadikan MDI Child
3. Pada
Menu Stript dibuat menu :
-Latihan
(dengan sub menu Latihan 1 sampai 4)
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
Form3.MdiParent = Me
Form3.Show()
End Sub
Private
Sub Latihan3ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Latihan3ToolStripMenuItem.Click
Form4.MdiParent = Me
Form4.Show()
End Sub
Private
Sub Latihan4ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Latihan4ToolStripMenuItem.Click
Form5.MdiParent = Me
Form5.Show()
End Sub
Scriptnya :
Private Sub MetuApaToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles
MetuApaToolStripMenuItem.Click
If
MsgBox("Arep Metu apa ?", vbQuestion + vbYesNo + vbDefaultButton2,
"Konfirmasi Metu") = vbYes Then Me.Close()
End Sub
Private Sub
RestartToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RestartToolStripMenuItem.Click
Application.Restart()
End Sub
-Windows (cascade,tile horizontal,tile vertical)
Private
Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles TileHorisontalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private
Sub CascadeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CascadeToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
Private
Sub TileVertikalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TileVertikalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub
4. Buat Menu ToolStript sesuai dengan gambar berikut : |
5. Buat
Ribbon Control menu Ribbon Page :
-Latihan
(dengan BarButton Latihan 1 sampai 4)Scriptnya :
Private
Sub BarButtonItem1_ItemClick(ByVal sender As System.Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs)
Handles BarButtonItem1.ItemClick
Form2.MdiParent = Me
Form2.Show()
End Sub
Private
Sub BarButtonItem2_ItemClick(ByVal sender As System.Object, ByVal e As
DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
Form3.MdiParent = Me
Form3.Show()
End Sub
Private
Sub BarButtonItem3_ItemClick(ByVal sender As System.Object, ByVal e As
DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
Form4.MdiParent
= Me
Form4.Show()
End Sub
Private
Sub BarButtonItem7_ItemClick(ByVal sender As System.Object, ByVal e As
DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem7.ItemClick
Form5.MdiParent = Me
Form5.Show()
End Sub
-Tugas
(dengan Barbutton Tugas 1 sampai 3)Scriptnya :
Private
Sub BarButtonItem8_ItemClick(ByVal sender As System.Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs)
Handles BarButtonItem8.ItemClick
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
Private
Sub BarButtonItem9_ItemClick(ByVal sender As System.Object, ByVal e As
DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem9.ItemClick
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private
Sub BarButtonItem10_ItemClick(ByVal sender As System.Object, ByVal e As
DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem10.ItemClick
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub
6. buat
ContextMenuStript :
-Lalu
buat ToolStriptMenuItems dengan menu restart dan keluar
Scriptnya
:
Private
Sub KeluarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles KeluarToolStripMenuItem.Click
If
MsgBox("Arep Metu apa ?", vbQuestion + vbYesNo + vbDefaultButton2,
"Konfirmasi Metu") = vbYes Then Me.Close()
End Sub
Private
Sub RestartToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RestartToolStripMenuItem1.Click
Application.Restart()
End Sub7. Maka Desain Keseluruhannya sebagai berikut:
8. Setelah selesai, jalankan program :
-Lalu kita panggil MDI Childnya :
-Lalu kita gunakan menu windows untuk mengubah tampilannya :
CascadeTile Vertical
Tile Horizontal
Tidak ada komentar:
Posting Komentar