Tugas Pemrograman Visual 4
Latihan Membuat menu & tool strip, dan MDI form
Nama : Anton Nugroho
NIM : 11.11.2352
Kelas : TI 11 A
Pada Posting saya kali ini, saya akan sedikit menjelaskan tentang pembuatan menu strip dan tool strip dalam visual studio 2010, menggunakan bahasa visual basic.
Berikut adalah screenshot nya :
Printscreen 1 |
Printscreen 2 |
dari screenshot di atas, di tunjukan penempatan menu strip di bagian atas dan tools strip di bagian samping kiri.
Menu digunakan untuk mengorganisasikan semua form
dan laporan pada aplikasi yang
dibuat, sehingga dapat di panggil dengan mudah.
dan menu strip adalah deretan menu yang ada pada tampilan awal aplikasi, seperti pada visual studio yaitu File, Edit, View, Project, DLL ..
Dan Menu Strip di visual studio ada pada toolbox Menu Strip Dari
Toolbox Kelompok Menus & Toolbars.
Dalam tugas kali ini , saya buat menu untuk merubah tata Letak form yang di buka dalam MDI,
ada 3 macam jenis tampilan menunya, yaitu cascade atau menumpuk, vertical atau menyamping, dan horizontal atau atas bawah.
dengan koodingnya :
Me.LayoutMdi(MdiLayout.Cascade) = "untuk posisi Cascade"
Me.LayoutMdi(MdiLayout.TileVertical) = "untuk posisi Vertical"
Me.LayoutMdi(MdiLayout.TileHorizontal) = "untuk posisi Horizontal"
menunya ada di dalam Tools > Layout Position
dan untuk keluar nya dengan kode :
If MsgBox("Do You want Log Off ?", 4 + 32 + 256, "Log Off") = vbYes Then
Me.Close()
End If
Me.Close()
End If
Cascade Position |
Horizontal Position |
Vertical Position |
Berikut adalah kooding method nya :
Public Class Form1
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 ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
Form2.ShowDialog()
End Sub
Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
Form3.ShowDialog()
End Sub
Private Sub ExitToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem2.Click
If MsgBox("Do You want Exit ?", 4 + 32 + 256, "Exit") = vbYes Then
Me.Close()
End If
End Sub
Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
If MsgBox("Do You want Log Off ?", 4 + 32 + 256, "Log Off") = vbYes Then
Me.Close()
End If
End Sub
Private Sub HorizontalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HorizontalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private Sub VerticalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerticalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileVertical)
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 ClearTextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearTextToolStripMenuItem.Click
TextBox1.Clear()
End Sub
Private Sub NewTextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTextToolStripMenuItem.Click
TextBox1.Clear()
TextBox1.Focus()
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Form2.MdiParent = Me
Form2.Show()
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
Form3.MdiParent = Me
Form3.Show()
End Sub
End Class
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 ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
Form2.ShowDialog()
End Sub
Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
Form3.ShowDialog()
End Sub
Private Sub ExitToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem2.Click
If MsgBox("Do You want Exit ?", 4 + 32 + 256, "Exit") = vbYes Then
Me.Close()
End If
End Sub
Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
If MsgBox("Do You want Log Off ?", 4 + 32 + 256, "Log Off") = vbYes Then
Me.Close()
End If
End Sub
Private Sub HorizontalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HorizontalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private Sub VerticalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerticalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileVertical)
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 ClearTextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearTextToolStripMenuItem.Click
TextBox1.Clear()
End Sub
Private Sub NewTextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTextToolStripMenuItem.Click
TextBox1.Clear()
TextBox1.Focus()
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Form2.MdiParent = Me
Form2.Show()
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
Form3.MdiParent = Me
Form3.Show()
End Sub
End Class
Mohon Maaf apabila banyak kekurangan dalam postingan kali ini, karena saya telah membuat sebisa saya , Terimakasih ..
:-)
Tidak ada komentar:
Posting Komentar