VB.Net/GUI/Menu — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:43, 26 мая 2010

Add Menu, Menu Item and bind action at run time

Imports System
Imports System.Collections
Imports System.Data
Imports System.IO
Imports System.Xml.Serialization
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Imports System.Drawing.Printing

Public Class MainClass
    Shared Sub Main()
       Dim form1 As Form = New Form1()
       Application.Run(form1) 
     End Sub
End Class




Public Class Form1
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents mnuExit As System.Windows.Forms.MenuItem
    Friend WithEvents mnuFile As System.Windows.Forms.MenuItem
    Friend WithEvents mnuNew As System.Windows.Forms.MenuItem
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.Container
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.MainMenu1 = New System.Windows.Forms.MainMenu()
        Me.mnuFile = New System.Windows.Forms.MenuItem()
        Me.mnuNew = New System.Windows.Forms.MenuItem()
        Me.mnuExit = New System.Windows.Forms.MenuItem()
        "
        "MainMenu1
        "
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile})
        "
        "mnuFile
        "
        Me.mnuFile.Index = 0
        Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuNew, Me.mnuExit})
        Me.mnuFile.Text = "File"
        "
        "mnuNew
        "
        Me.mnuNew.Index = 0
        Me.mnuNew.Text = "New"
        "
        "mnuExit
        "
        Me.mnuExit.Index = 1
        Me.mnuExit.Text = "Exit"
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
        Me.ClientSize = New System.Drawing.Size(292, 272)
        Me.Menu = Me.MainMenu1
        Me.Name = "Form1"
        Me.Text = "MDI Example 2"
    End Sub
#End Region
    Private Sub Form1_Load(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) _
  Handles MyBase.Load
        Me.Text = "I"m an MDI Parent"
        Me.IsMdiContainer = True
        Dim MyChild As New System.Windows.Forms.Form()
        MyChild.MdiParent = Me
        MyChild.Show()
        MyChild.Text = "First MDI Child"
        InitializeMenu()
    End Sub
    Public Sub InitializeMenu()
        Dim mnuWindow As New MenuItem("&Window")
        MainMenu1.MenuItems.Add(mnuWindow)
        mnuWindow.MenuItems.Add(New MenuItem("&Cascade", AddressOf WindowCascade_Clicked))
        mnuWindow.MenuItems.Add(New MenuItem("Tile &Horizontal", AddressOf WindowTileHoriz_Clicked))
        mnuWindow.MenuItems.Add(New MenuItem("Tile &Vertical", AddressOf WindowTileVert_Clicked))
        mnuWindow.MdiList = True
    End Sub
    Protected Sub WindowCascade_Clicked(ByVal Sender As Object, _
      ByVal e As System.EventArgs)
        Me.LayoutMdi(MdiLayout.Cascade)
    End Sub
    Protected Sub WindowTileHoriz_Clicked(ByVal Sender As Object, _
      ByVal e As System.EventArgs)
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    End Sub
    Protected Sub WindowTileVert_Clicked(ByVal Sender As Object, _
      ByVal e As System.EventArgs)
        Me.LayoutMdi(MdiLayout.TileVertical)
    End Sub
    Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
        System.Environment.Exit(0)
    End Sub
    
    Private Sub mnuNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuNew.Click
        Static numOfChildren As Integer = 2
        Dim MyChild As New System.Windows.Forms.Form()
        MyChild.MdiParent = Me
        MyChild.Show()
        MyChild.Text = "MDI Child " & CStr(numOfChildren)
        numOfChildren += 1
    End Sub
End Class


Add menu to a frame and implement the menu action

Imports System
Imports System.Collections
Imports System.ruponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class BaseForm
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    Friend WithEvents menuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents fileExitMenuItem As System.Windows.Forms.MenuItem
    Protected WithEvents statusBar As System.Windows.Forms.StatusBar
    Friend WithEvents menuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents helpAboutMenuItem As System.Windows.Forms.MenuItem
    Friend WithEvents mainMenu1 As System.Windows.Forms.MainMenu
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.menuItem1 = New System.Windows.Forms.MenuItem()
        Me.fileExitMenuItem = New System.Windows.Forms.MenuItem()
        Me.statusBar = New System.Windows.Forms.StatusBar()
        Me.menuItem3 = New System.Windows.Forms.MenuItem()
        Me.helpAboutMenuItem = New System.Windows.Forms.MenuItem()
        Me.mainMenu1 = New System.Windows.Forms.MainMenu()
        Me.SuspendLayout()
        "
        "menuItem1
        "
        Me.menuItem1.Index = 0
        Me.menuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.fileExitMenuItem})
        Me.menuItem1.Text = "&File"
        "
        "fileExitMenuItem
        "
        Me.fileExitMenuItem.Index = 0
        Me.fileExitMenuItem.Text = "E&xit"
        "
        "statusBar
        "
        Me.statusBar.Location = New System.Drawing.Point(0, 72)
        Me.statusBar.Name = "statusBar"
        Me.statusBar.Size = New System.Drawing.Size(176, 22)
        Me.statusBar.TabIndex = 1
        Me.statusBar.Text = "Ready"
        "
        "menuItem3
        "
        Me.menuItem3.Index = 1
        Me.menuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.helpAboutMenuItem})
        Me.menuItem3.Text = "&Help"
        "
        "helpAboutMenuItem
        "
        Me.helpAboutMenuItem.Index = 0
        Me.helpAboutMenuItem.Text = "&About..."
        "
        "mainMenu1
        "
        Me.mainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuItem1, Me.menuItem3})
        "
        "BaseForm
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(176, 94)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.statusBar})
        Me.Menu = Me.mainMenu1
        Me.Name = "BaseForm"
        Me.Text = "BaseForm"
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub fileExitMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles fileExitMenuItem.Click
        Me.Close()
    End Sub
    Private Sub helpAboutMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles helpAboutMenuItem.Click
        MessageBox.Show("Message?", "About")
    End Sub
End Class
Public Class MainClass
    Shared Sub Main()
        Dim myform As Form = New BaseForm()
        Application.Run(myform)
    End Sub
End Class


Add Menu to Parent MDI Frame when opening a childred Frame

Imports System
Imports System.Runtime.InteropServices
Imports System.Drawing
Imports System.ruponentModel
Imports System.Windows.Forms
Imports System.IO
Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Dim myform As Form = New MDIParent1()
        Application.Run(myform)
    End Sub
End Class

Public Class Form1
    Private m_FileName As String
    Private m_IsDirty As Boolean
    Public Sub LoadFile(ByVal file_name As String, ByVal mdi_parent As MDIParent1)
        m_FileName = file_name
        Me.MdiParent = mdi_parent
        txtContents.Text = File.ReadAllText(m_FileName)
        txtContents.Select(0, 0)
        Me.Text = New FileInfo(m_FileName).Name
        m_IsDirty = False
    End Sub
    Private Sub mnuFileClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileClose.Click
        Me.Close()
    End Sub
    Private Sub mdiChild_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If m_IsDirty Then
            Select Case MessageBox.Show( _
                    "Save the changes?", _
                    "Save Changes?", _
                    MessageBoxButtons.YesNoCancel, _
                    MessageBoxIcon.Question)
                Case Windows.Forms.DialogResult.Yes
                    SaveFile()
                    e.Cancel = m_IsDirty
                Case Windows.Forms.DialogResult.No
                Case Windows.Forms.DialogResult.Cancel
                    e.Cancel = True
            End Select
        End If
    End Sub
    Private Sub SaveFile()
        File.WriteAllText(m_FileName, txtContents.Text)
        m_IsDirty = False
        Me.Text = New FileInfo(m_FileName).Name
    End Sub
    Private Sub txtContents_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtContents.TextChanged
        m_IsDirty = True
        If Not Me.Text.EndsWith("*") Then
            Me.Text = New FileInfo(m_FileName).Name & "*"
        End If
    End Sub
    " Save the changes.
    Private Sub mnuFileSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileSave.Click
        SaveFile()
    End Sub
End Class

<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _
Partial Public Class Form1
    Inherits System.Windows.Forms.Form
    "Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.txtContents = New System.Windows.Forms.TextBox
        Me.MenuStrip1 = New System.Windows.Forms.MenuStrip
        Me.mnuFile = New System.Windows.Forms.ToolStripMenuItem
        Me.mnuFileSave = New System.Windows.Forms.ToolStripMenuItem
        Me.mnuFileClose = New System.Windows.Forms.ToolStripMenuItem
        Me.MenuStrip1.SuspendLayout()
        Me.SuspendLayout()
        "
        "txtContents
        "
        Me.txtContents.Dock = System.Windows.Forms.DockStyle.Fill
        Me.txtContents.Location = New System.Drawing.Point(0, 24)
        Me.txtContents.Multiline = True
        Me.txtContents.Name = "txtContents"
        Me.txtContents.Size = New System.Drawing.Size(292, 249)
        Me.txtContents.TabIndex = 7
        "
        "MenuStrip1
        "
        Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuFile})
        Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
        Me.MenuStrip1.Name = "MenuStrip1"
        Me.MenuStrip1.Size = New System.Drawing.Size(292, 24)
        Me.MenuStrip1.TabIndex = 8
        Me.MenuStrip1.Text = "MenuStrip1"
        "
        "mnuFile
        "
        Me.mnuFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuFileSave, Me.mnuFileClose})
        Me.mnuFile.Name = "mnuFile"
        Me.mnuFile.Size = New System.Drawing.Size(44, 20)
        Me.mnuFile.Text = "&File"
        "
        "mnuFileSave
        "
        Me.mnuFileSave.Name = "mnuFileSave"
        Me.mnuFileSave.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.S), System.Windows.Forms.Keys)
        Me.mnuFileSave.Size = New System.Drawing.Size(165, 22)
        Me.mnuFileSave.Text = "&Save"
        "
        "mnuFileClose
        "
        Me.mnuFileClose.Name = "mnuFileClose"
        Me.mnuFileClose.Size = New System.Drawing.Size(165, 22)
        Me.mnuFileClose.Text = "&Close"
        "
        "Form1
        "
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.Add(Me.txtContents)
        Me.Controls.Add(Me.MenuStrip1)
        Me.Name = "Form1"
        Me.Text = "MdiEdit []"
        Me.MenuStrip1.ResumeLayout(False)
        Me.MenuStrip1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()
    End Sub
    Friend WithEvents txtContents As System.Windows.Forms.TextBox
    Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip
    Friend WithEvents mnuFile As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents mnuFileSave As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents mnuFileClose As System.Windows.Forms.ToolStripMenuItem
End Class

Public Class MDIParent1
    Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) Handles NewToolStripMenuItem.Click, NewToolStripButton.Click, NewWindowToolStripMenuItem.Click
        Dim frm As New Form1
        frm.MdiParent = Me
        frm.Show()
    End Sub
    Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs) Handles OpenToolStripMenuItem.Click, OpenToolStripButton.Click
        Dim dlgOpen As New OpenFileDialog
        If dlgOpen.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim frm As New Form1
            frm.txtContents.Text = File.ReadAllText(dlgOpen.FileName)
            frm.txtContents.Select(0, 0)
            frm.Text = New FileInfo(dlgOpen.FileName).Name
            frm.MdiParent = Me
            frm.Show()
        End If
    End Sub
    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveAsToolStripMenuItem.Click
        Dim SaveFileDialog As New SaveFileDialog
        SaveFileDialog.InitialDirectory = My.ruputer.FileSystem.SpecialDirectories.MyDocuments
        SaveFileDialog.Filter = "Text Files (*.txt)|*.txt"
        SaveFileDialog.ShowDialog(Me)
        Dim FileName As String = SaveFileDialog.FileName
        MessageBox.Show(FileName+ "Saved.")
    End Sub
    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub
    Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CutToolStripMenuItem.Click
        MessageBox.Show("Cut")
    End Sub
    Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CopyToolStripMenuItem.Click
        MessageBox.Show("Copy")
    End Sub
    Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PasteToolStripMenuItem.Click
        MessageBox.Show("Paste")
    End Sub
    Private Sub ToolBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ToolBarToolStripMenuItem.Click
        Me.ToolStrip.Visible = Me.ToolBarToolStripMenuItem.Checked
    End Sub
    Private Sub StatusBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StatusBarToolStripMenuItem.Click
        Me.StatusStrip.Visible = Me.StatusBarToolStripMenuItem.Checked
    End Sub
    Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CascadeToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.Cascade)
    End Sub
    Private Sub TileVerticleToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TileVerticalToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.TileVertical)
    End Sub
    Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TileHorizontalToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    End Sub
    Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ArrangeIconsToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.ArrangeIcons)
    End Sub
    Private Sub MinimizeAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MinimizeAllToolStripMenuItem.Click
        For Each frm As Form In Me.MdiChildren
            frm.WindowState = FormWindowState.Minimized
        Next frm
    End Sub
    Private Sub RestoreAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RestoreAllToolStripMenuItem.Click
        For Each frm As Form In Me.MdiChildren
            frm.WindowState = FormWindowState.Normal
        Next frm
    End Sub
    Private Sub MaximizeAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MaximizeAllToolStripMenuItem.Click
        For Each frm As Form In Me.MdiChildren
            frm.WindowState = FormWindowState.Maximized
        Next frm
    End Sub
    Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CloseAllToolStripMenuItem.Click
        For Each frm As Form In Me.MdiChildren
            frm.Close()
        Next
    End Sub
End Class

<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _
Partial Public Class MDIParent1
    Inherits System.Windows.Forms.Form
    "Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.ruponents = New System.ruponentModel.Container
        "Dim resources As System.ruponentModel.ruponentResourceManager = New System.ruponentModel.ruponentResourceManager(GetType(MDIParent1))
        Me.ContentsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.HelpMenu = New System.Windows.Forms.ToolStripMenuItem
        Me.IndexToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.SearchToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolStripSeparator8 = New System.Windows.Forms.ToolStripSeparator
        Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ArrangeIconsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.CloseAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.NewWindowToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.WindowsMenu = New System.Windows.Forms.ToolStripMenuItem
        Me.CascadeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.TileVerticalToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.TileHorizontalToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.OptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.HelpToolStripButton = New System.Windows.Forms.ToolStripButton
        Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator
        Me.PrintPreviewToolStripButton = New System.Windows.Forms.ToolStripButton
        Me.ToolTip = New System.Windows.Forms.ToolTip(Me.ruponents)
        Me.ToolStripStatusLabel = New System.Windows.Forms.ToolStripStatusLabel
        Me.StatusStrip = New System.Windows.Forms.StatusStrip
        Me.PrintToolStripButton = New System.Windows.Forms.ToolStripButton
        Me.NewToolStripButton = New System.Windows.Forms.ToolStripButton
        Me.ToolStrip = New System.Windows.Forms.ToolStrip
        Me.OpenToolStripButton = New System.Windows.Forms.ToolStripButton
        Me.SaveToolStripButton = New System.Windows.Forms.ToolStripButton
        Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator
        Me.PrintPreviewToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.PrintToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolStripSeparator4 = New System.Windows.Forms.ToolStripSeparator
        Me.ExitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolStripSeparator5 = New System.Windows.Forms.ToolStripSeparator
        Me.PrintSetupToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.SaveAsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.NewToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.FileMenu = New System.Windows.Forms.ToolStripMenuItem
        Me.OpenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator
        Me.SaveToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.MenuStrip = New System.Windows.Forms.MenuStrip
        Me.EditMenu = New System.Windows.Forms.ToolStripMenuItem
        Me.UndoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.RedoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolStripSeparator6 = New System.Windows.Forms.ToolStripSeparator
        Me.CutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.CopyToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.PasteToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolStripSeparator7 = New System.Windows.Forms.ToolStripSeparator
        Me.SelectAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ViewMenu = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolBarToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.StatusBarToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolsMenu = New System.Windows.Forms.ToolStripMenuItem
        Me.MaximizeAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.MinimizeAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.RestoreAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.StatusStrip.SuspendLayout()
        Me.ToolStrip.SuspendLayout()
        Me.MenuStrip.SuspendLayout()
        Me.SuspendLayout()
        "
        "ContentsToolStripMenuItem
        "
        Me.ContentsToolStripMenuItem.Name = "ContentsToolStripMenuItem"
        Me.ContentsToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.F1), System.Windows.Forms.Keys)
        Me.ContentsToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.ContentsToolStripMenuItem.Text = "&Contents"
        "
        "HelpMenu
        "
        Me.HelpMenu.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ContentsToolStripMenuItem, Me.IndexToolStripMenuItem, Me.SearchToolStripMenuItem, Me.ToolStripSeparator8, Me.AboutToolStripMenuItem})
        Me.HelpMenu.Name = "HelpMenu"
        Me.HelpMenu.Size = New System.Drawing.Size(49, 20)
        Me.HelpMenu.Text = "&Help"
        "
        "IndexToolStripMenuItem
        "
        "Me.IndexToolStripMenuItem.Image = CType(resources.GetObject("IndexToolStripMenuItem.Image"), System.Drawing.Image)
        Me.IndexToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.IndexToolStripMenuItem.Name = "IndexToolStripMenuItem"
        Me.IndexToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.IndexToolStripMenuItem.Text = "&Index"
        "
        "SearchToolStripMenuItem
        "
        "Me.SearchToolStripMenuItem.Image = CType(resources.GetObject("SearchToolStripMenuItem.Image"), System.Drawing.Image)
        Me.SearchToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.SearchToolStripMenuItem.Name = "SearchToolStripMenuItem"
        Me.SearchToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.SearchToolStripMenuItem.Text = "&Search"
        "
        "ToolStripSeparator8
        "
        Me.ToolStripSeparator8.Name = "ToolStripSeparator8"
        Me.ToolStripSeparator8.Size = New System.Drawing.Size(191, 6)
        "
        "AboutToolStripMenuItem
        "
        Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"
        Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.AboutToolStripMenuItem.Text = "&About ..."
        "
        "ArrangeIconsToolStripMenuItem
        "
        Me.ArrangeIconsToolStripMenuItem.Name = "ArrangeIconsToolStripMenuItem"
        Me.ArrangeIconsToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.ArrangeIconsToolStripMenuItem.Text = "&Arrange Icons"
        "
        "CloseAllToolStripMenuItem
        "
        Me.CloseAllToolStripMenuItem.Name = "CloseAllToolStripMenuItem"
        Me.CloseAllToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.CloseAllToolStripMenuItem.Text = "C&lose All"
        "
        "NewWindowToolStripMenuItem
        "
        Me.NewWindowToolStripMenuItem.Name = "NewWindowToolStripMenuItem"
        Me.NewWindowToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.NewWindowToolStripMenuItem.Text = "&New Window"
        "
        "WindowsMenu
        "
        Me.WindowsMenu.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NewWindowToolStripMenuItem, Me.CascadeToolStripMenuItem, Me.TileVerticalToolStripMenuItem, Me.TileHorizontalToolStripMenuItem, Me.MinimizeAllToolStripMenuItem, Me.MaximizeAllToolStripMenuItem, Me.RestoreAllToolStripMenuItem, Me.CloseAllToolStripMenuItem, Me.ArrangeIconsToolStripMenuItem})
        Me.WindowsMenu.Name = "WindowsMenu"
        Me.WindowsMenu.Size = New System.Drawing.Size(78, 20)
        Me.WindowsMenu.Text = "&Windows"
        "
        "CascadeToolStripMenuItem
        "
        Me.CascadeToolStripMenuItem.Name = "CascadeToolStripMenuItem"
        Me.CascadeToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.CascadeToolStripMenuItem.Text = "&Cascade"
        "
        "TileVerticalToolStripMenuItem
        "
        Me.TileVerticalToolStripMenuItem.Name = "TileVerticalToolStripMenuItem"
        Me.TileVerticalToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.TileVerticalToolStripMenuItem.Text = "Tile &Vertical"
        "
        "TileHorizontalToolStripMenuItem
        "
        Me.TileHorizontalToolStripMenuItem.Name = "TileHorizontalToolStripMenuItem"
        Me.TileHorizontalToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.TileHorizontalToolStripMenuItem.Text = "Tile &Horizontal"
        "
        "OptionsToolStripMenuItem
        "
        Me.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem"
        Me.OptionsToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
        Me.OptionsToolStripMenuItem.Text = "&Options"
        "
        "HelpToolStripButton
        "
        Me.HelpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        "Me.HelpToolStripButton.Image = CType(resources.GetObject("HelpToolStripButton.Image"), System.Drawing.Image)
        Me.HelpToolStripButton.ImageTransparentColor = System.Drawing.Color.Black
        Me.HelpToolStripButton.Name = "HelpToolStripButton"
        Me.HelpToolStripButton.Size = New System.Drawing.Size(23, 22)
        Me.HelpToolStripButton.Text = "Help"
        "
        "ToolStripSeparator2
        "
        Me.ToolStripSeparator2.Name = "ToolStripSeparator2"
        Me.ToolStripSeparator2.Size = New System.Drawing.Size(6, 25)
        "
        "PrintPreviewToolStripButton
        "
        Me.PrintPreviewToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        "Me.PrintPreviewToolStripButton.Image = CType(resources.GetObject("PrintPreviewToolStripButton.Image"), System.Drawing.Image)
        Me.PrintPreviewToolStripButton.ImageTransparentColor = System.Drawing.Color.Black
        Me.PrintPreviewToolStripButton.Name = "PrintPreviewToolStripButton"
        Me.PrintPreviewToolStripButton.Size = New System.Drawing.Size(23, 22)
        Me.PrintPreviewToolStripButton.Text = "Print Preview"
        "
        "ToolStripStatusLabel
        "
        Me.ToolStripStatusLabel.Name = "ToolStripStatusLabel"
        Me.ToolStripStatusLabel.Size = New System.Drawing.Size(47, 17)
        Me.ToolStripStatusLabel.Text = "Status"
        "
        "StatusStrip
        "
        Me.StatusStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel})
        Me.StatusStrip.Location = New System.Drawing.Point(0, 431)
        Me.StatusStrip.Name = "StatusStrip"
        Me.StatusStrip.Size = New System.Drawing.Size(632, 22)
        Me.StatusStrip.TabIndex = 7
        Me.StatusStrip.Text = "StatusStrip"
        "
        "PrintToolStripButton
        "
        Me.PrintToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        "Me.PrintToolStripButton.Image = CType(resources.GetObject("PrintToolStripButton.Image"), System.Drawing.Image)
        Me.PrintToolStripButton.ImageTransparentColor = System.Drawing.Color.Black
        Me.PrintToolStripButton.Name = "PrintToolStripButton"
        Me.PrintToolStripButton.Size = New System.Drawing.Size(23, 22)
        Me.PrintToolStripButton.Text = "Print"
        "
        "NewToolStripButton
        "
        Me.NewToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        "Me.NewToolStripButton.Image = CType(resources.GetObject("NewToolStripButton.Image"), System.Drawing.Image)
        Me.NewToolStripButton.ImageTransparentColor = System.Drawing.Color.Black
        Me.NewToolStripButton.Name = "NewToolStripButton"
        Me.NewToolStripButton.Size = New System.Drawing.Size(23, 22)
        Me.NewToolStripButton.Text = "New"
        "
        "ToolStrip
        "
        Me.ToolStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NewToolStripButton, Me.OpenToolStripButton, Me.SaveToolStripButton, Me.ToolStripSeparator1, Me.PrintToolStripButton, Me.PrintPreviewToolStripButton, Me.ToolStripSeparator2, Me.HelpToolStripButton})
        Me.ToolStrip.Location = New System.Drawing.Point(0, 24)
        Me.ToolStrip.Name = "ToolStrip"
        Me.ToolStrip.Size = New System.Drawing.Size(632, 25)
        Me.ToolStrip.TabIndex = 6
        Me.ToolStrip.Text = "ToolStrip"
        "
        "OpenToolStripButton
        "
        Me.OpenToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        "Me.OpenToolStripButton.Image = CType(resources.GetObject("OpenToolStripButton.Image"), System.Drawing.Image)
        Me.OpenToolStripButton.ImageTransparentColor = System.Drawing.Color.Black
        Me.OpenToolStripButton.Name = "OpenToolStripButton"
        Me.OpenToolStripButton.Size = New System.Drawing.Size(23, 22)
        Me.OpenToolStripButton.Text = "Open"
        "
        "SaveToolStripButton
        "
        Me.SaveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        "Me.SaveToolStripButton.Image = CType(resources.GetObject("SaveToolStripButton.Image"), System.Drawing.Image)
        Me.SaveToolStripButton.ImageTransparentColor = System.Drawing.Color.Black
        Me.SaveToolStripButton.Name = "SaveToolStripButton"
        Me.SaveToolStripButton.Size = New System.Drawing.Size(23, 22)
        Me.SaveToolStripButton.Text = "Save"
        "
        "ToolStripSeparator1
        "
        Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
        Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 25)
        "
        "PrintPreviewToolStripMenuItem
        "
        "Me.PrintPreviewToolStripMenuItem.Image = CType(resources.GetObject("PrintPreviewToolStripMenuItem.Image"), System.Drawing.Image)
        Me.PrintPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.PrintPreviewToolStripMenuItem.Name = "PrintPreviewToolStripMenuItem"
        Me.PrintPreviewToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.PrintPreviewToolStripMenuItem.Text = "Print Pre&view"
        "
        "PrintToolStripMenuItem
        "
        "Me.PrintToolStripMenuItem.Image = CType(resources.GetObject("PrintToolStripMenuItem.Image"), System.Drawing.Image)
        Me.PrintToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.PrintToolStripMenuItem.Name = "PrintToolStripMenuItem"
        Me.PrintToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.P), System.Windows.Forms.Keys)
        Me.PrintToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.PrintToolStripMenuItem.Text = "&Print"
        "
        "ToolStripSeparator4
        "
        Me.ToolStripSeparator4.Name = "ToolStripSeparator4"
        Me.ToolStripSeparator4.Size = New System.Drawing.Size(169, 6)
        "
        "ExitToolStripMenuItem
        "
        Me.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"
        Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.ExitToolStripMenuItem.Text = "E&xit"
        "
        "ToolStripSeparator5
        "
        Me.ToolStripSeparator5.Name = "ToolStripSeparator5"
        Me.ToolStripSeparator5.Size = New System.Drawing.Size(169, 6)
        "
        "PrintSetupToolStripMenuItem
        "
        Me.PrintSetupToolStripMenuItem.Name = "PrintSetupToolStripMenuItem"
        Me.PrintSetupToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.PrintSetupToolStripMenuItem.Text = "Print Setup"
        "
        "SaveAsToolStripMenuItem
        "
        Me.SaveAsToolStripMenuItem.Name = "SaveAsToolStripMenuItem"
        Me.SaveAsToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.SaveAsToolStripMenuItem.Text = "Save &As"
        "
        "NewToolStripMenuItem
        "
        "Me.NewToolStripMenuItem.Image = CType(resources.GetObject("NewToolStripMenuItem.Image"), System.Drawing.Image)
        Me.NewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.NewToolStripMenuItem.Name = "NewToolStripMenuItem"
        Me.NewToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.N), System.Windows.Forms.Keys)
        Me.NewToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.NewToolStripMenuItem.Text = "&New"
        "
        "FileMenu
        "
        Me.FileMenu.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NewToolStripMenuItem, Me.OpenToolStripMenuItem, Me.ToolStripSeparator3, Me.SaveToolStripMenuItem, Me.SaveAsToolStripMenuItem, Me.ToolStripSeparator4, Me.PrintToolStripMenuItem, Me.PrintPreviewToolStripMenuItem, Me.PrintSetupToolStripMenuItem, Me.ToolStripSeparator5, Me.ExitToolStripMenuItem})
        Me.FileMenu.ImageTransparentColor = System.Drawing.SystemColors.ActiveBorder
        Me.FileMenu.Name = "FileMenu"
        Me.FileMenu.Size = New System.Drawing.Size(44, 20)
        Me.FileMenu.Text = "&File"
        "
        "OpenToolStripMenuItem
        "
        "Me.OpenToolStripMenuItem.Image = CType(resources.GetObject("OpenToolStripMenuItem.Image"), System.Drawing.Image)
        Me.OpenToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem"
        Me.OpenToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.O), System.Windows.Forms.Keys)
        Me.OpenToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.OpenToolStripMenuItem.Text = "&Open"
        "
        "ToolStripSeparator3
        "
        Me.ToolStripSeparator3.Name = "ToolStripSeparator3"
        Me.ToolStripSeparator3.Size = New System.Drawing.Size(169, 6)
        "
        "SaveToolStripMenuItem
        "
        "Me.SaveToolStripMenuItem.Image = CType(resources.GetObject("SaveToolStripMenuItem.Image"), System.Drawing.Image)
        Me.SaveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"
        Me.SaveToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.S), System.Windows.Forms.Keys)
        Me.SaveToolStripMenuItem.Size = New System.Drawing.Size(172, 22)
        Me.SaveToolStripMenuItem.Text = "&Save"
        "
        "MenuStrip
        "
        Me.MenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileMenu, Me.EditMenu, Me.ViewMenu, Me.ToolsMenu, Me.WindowsMenu, Me.HelpMenu})
        Me.MenuStrip.Location = New System.Drawing.Point(0, 0)
        Me.MenuStrip.MdiWindowListItem = Me.WindowsMenu
        Me.MenuStrip.Name = "MenuStrip"
        Me.MenuStrip.Size = New System.Drawing.Size(632, 24)
        Me.MenuStrip.TabIndex = 5
        Me.MenuStrip.Text = "MenuStrip"
        "
        "EditMenu
        "
        Me.EditMenu.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.UndoToolStripMenuItem, Me.RedoToolStripMenuItem, Me.ToolStripSeparator6, Me.CutToolStripMenuItem, Me.CopyToolStripMenuItem, Me.PasteToolStripMenuItem, Me.ToolStripSeparator7, Me.SelectAllToolStripMenuItem})
        Me.EditMenu.Name = "EditMenu"
        Me.EditMenu.Size = New System.Drawing.Size(44, 20)
        Me.EditMenu.Text = "&Edit"
        "
        "UndoToolStripMenuItem
        "
        "Me.UndoToolStripMenuItem.Image = CType(resources.GetObject("UndoToolStripMenuItem.Image"), System.Drawing.Image)
        Me.UndoToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.UndoToolStripMenuItem.Name = "UndoToolStripMenuItem"
        Me.UndoToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Z), System.Windows.Forms.Keys)
        Me.UndoToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.UndoToolStripMenuItem.Text = "&Undo"
        "
        "RedoToolStripMenuItem
        "
        "Me.RedoToolStripMenuItem.Image = CType(resources.GetObject("RedoToolStripMenuItem.Image"), System.Drawing.Image)
        Me.RedoToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.RedoToolStripMenuItem.Name = "RedoToolStripMenuItem"
        Me.RedoToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Y), System.Windows.Forms.Keys)
        Me.RedoToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.RedoToolStripMenuItem.Text = "&Redo"
        "
        "ToolStripSeparator6
        "
        Me.ToolStripSeparator6.Name = "ToolStripSeparator6"
        Me.ToolStripSeparator6.Size = New System.Drawing.Size(191, 6)
        "
        "CutToolStripMenuItem
        "
        "Me.CutToolStripMenuItem.Image = CType(resources.GetObject("CutToolStripMenuItem.Image"), System.Drawing.Image)
        Me.CutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.CutToolStripMenuItem.Name = "CutToolStripMenuItem"
        Me.CutToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.X), System.Windows.Forms.Keys)
        Me.CutToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.CutToolStripMenuItem.Text = "Cu&t"
        "
        "CopyToolStripMenuItem
        "
        "Me.CopyToolStripMenuItem.Image = CType(resources.GetObject("CopyToolStripMenuItem.Image"), System.Drawing.Image)
        Me.CopyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.CopyToolStripMenuItem.Name = "CopyToolStripMenuItem"
        Me.CopyToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.C), System.Windows.Forms.Keys)
        Me.CopyToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.CopyToolStripMenuItem.Text = "&Copy"
        "
        "PasteToolStripMenuItem
        "
        "Me.PasteToolStripMenuItem.Image = CType(resources.GetObject("PasteToolStripMenuItem.Image"), System.Drawing.Image)
        Me.PasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black
        Me.PasteToolStripMenuItem.Name = "PasteToolStripMenuItem"
        Me.PasteToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.V), System.Windows.Forms.Keys)
        Me.PasteToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.PasteToolStripMenuItem.Text = "&Paste"
        "
        "ToolStripSeparator7
        "
        Me.ToolStripSeparator7.Name = "ToolStripSeparator7"
        Me.ToolStripSeparator7.Size = New System.Drawing.Size(191, 6)
        "
        "SelectAllToolStripMenuItem
        "
        Me.SelectAllToolStripMenuItem.Name = "SelectAllToolStripMenuItem"
        Me.SelectAllToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.A), System.Windows.Forms.Keys)
        Me.SelectAllToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
        Me.SelectAllToolStripMenuItem.Text = "Select &All"
        "
        "ViewMenu
        "
        Me.ViewMenu.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolBarToolStripMenuItem, Me.StatusBarToolStripMenuItem})
        Me.ViewMenu.Name = "ViewMenu"
        Me.ViewMenu.Size = New System.Drawing.Size(52, 20)
        Me.ViewMenu.Text = "&View"
        "
        "ToolBarToolStripMenuItem
        "
        Me.ToolBarToolStripMenuItem.Checked = True
        Me.ToolBarToolStripMenuItem.CheckOnClick = True
        Me.ToolBarToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked
        Me.ToolBarToolStripMenuItem.Name = "ToolBarToolStripMenuItem"
        Me.ToolBarToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
        Me.ToolBarToolStripMenuItem.Text = "&Toolbar"
        "
        "StatusBarToolStripMenuItem
        "
        Me.StatusBarToolStripMenuItem.Checked = True
        Me.StatusBarToolStripMenuItem.CheckOnClick = True
        Me.StatusBarToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked
        Me.StatusBarToolStripMenuItem.Name = "StatusBarToolStripMenuItem"
        Me.StatusBarToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
        Me.StatusBarToolStripMenuItem.Text = "&Status Bar"
        "
        "ToolsMenu
        "
        Me.ToolsMenu.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OptionsToolStripMenuItem})
        Me.ToolsMenu.Name = "ToolsMenu"
        Me.ToolsMenu.Size = New System.Drawing.Size(54, 20)
        Me.ToolsMenu.Text = "&Tools"
        "
        "MaximizeAllToolStripMenuItem
        "
        Me.MaximizeAllToolStripMenuItem.Name = "MaximizeAllToolStripMenuItem"
        Me.MaximizeAllToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.MaximizeAllToolStripMenuItem.Text = "Ma&ximize All"
        "
        "MinimizeAllToolStripMenuItem
        "
        Me.MinimizeAllToolStripMenuItem.Name = "MinimizeAllToolStripMenuItem"
        Me.MinimizeAllToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.MinimizeAllToolStripMenuItem.Text = "&Minimize All"
        "
        "RestoreAllToolStripMenuItem
        "
        Me.RestoreAllToolStripMenuItem.Name = "RestoreAllToolStripMenuItem"
        Me.RestoreAllToolStripMenuItem.Size = New System.Drawing.Size(179, 22)
        Me.RestoreAllToolStripMenuItem.Text = "&Restore All"
        "
        "MDIParent1
        "
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(632, 453)
        Me.Controls.Add(Me.ToolStrip)
        Me.Controls.Add(Me.MenuStrip)
        Me.Controls.Add(Me.StatusStrip)
        Me.IsMdiContainer = True
        Me.MainMenuStrip = Me.MenuStrip
        Me.Name = "MDIParent1"
        Me.Text = "MDIParent1"
        Me.StatusStrip.ResumeLayout(False)
        Me.StatusStrip.PerformLayout()
        Me.ToolStrip.ResumeLayout(False)
        Me.ToolStrip.PerformLayout()
        Me.MenuStrip.ResumeLayout(False)
        Me.MenuStrip.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()
    End Sub
    Friend WithEvents ContentsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents HelpMenu As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents IndexToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents SearchToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripSeparator8 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents AboutToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ArrangeIconsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents CloseAllToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents NewWindowToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents WindowsMenu As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents CascadeToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents TileVerticalToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents TileHorizontalToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents OptionsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents HelpToolStripButton As System.Windows.Forms.ToolStripButton
    Friend WithEvents ToolStripSeparator2 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents PrintPreviewToolStripButton As System.Windows.Forms.ToolStripButton
    Friend WithEvents ToolTip As System.Windows.Forms.ToolTip
    Friend WithEvents ToolStripStatusLabel As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents StatusStrip As System.Windows.Forms.StatusStrip
    Friend WithEvents PrintToolStripButton As System.Windows.Forms.ToolStripButton
    Friend WithEvents NewToolStripButton As System.Windows.Forms.ToolStripButton
    Friend WithEvents ToolStrip As System.Windows.Forms.ToolStrip
    Friend WithEvents OpenToolStripButton As System.Windows.Forms.ToolStripButton
    Friend WithEvents SaveToolStripButton As System.Windows.Forms.ToolStripButton
    Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents PrintPreviewToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents PrintToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripSeparator4 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents ExitToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripSeparator5 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents PrintSetupToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents SaveAsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents NewToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents FileMenu As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents OpenToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripSeparator3 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents SaveToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents MenuStrip As System.Windows.Forms.MenuStrip
    Friend WithEvents EditMenu As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents UndoToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents RedoToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripSeparator6 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents CutToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents CopyToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents PasteToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripSeparator7 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents SelectAllToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ViewMenu As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolBarToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents StatusBarToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolsMenu As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents MinimizeAllToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents MaximizeAllToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents RestoreAllToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
End Class


Create Menu at run time

Imports System
Imports System.Drawing
Imports System.Reflection
Imports System.Windows.Forms
Imports System.IO

public class MainClass
   Shared Sub Main()
      Dim form1 As Form = New Form1
      Application.Run(form1)
   End Sub
End Class



Public Class Form1
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        "
        "TextBox1
        "
        Me.TextBox1.Font = New System.Drawing.Font("Verdana", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TextBox1.Location = New System.Drawing.Point(4, 6)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.TextBox1.Size = New System.Drawing.Size(272, 186)
        Me.TextBox1.TabIndex = 1
        Me.TextBox1.Text = ""
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(280, 257)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1})
        Me.Name = "Form1"
        Me.Text = "Menu Demo"
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim menu As New MainMenu()
        Dim item As MenuItem
        item = New MenuItem("File")
        item.MenuItems.Add("New", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Open", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Exit")
        menu.MenuItems.Add(item)
        item = New MenuItem("Edit")
        item.MenuItems.Add("Copy", New System.EventHandler(AddressOf Me.EditCopy))
        item.MenuItems.Add("Cut", New System.EventHandler(AddressOf Me.EditCut))
        item.MenuItems.Add("Paste", New System.EventHandler(AddressOf Me.EditPaste))
        menu.MenuItems.Add(item)
        item = New MenuItem("Format")
        item.MenuItems.Add("Font")
        item.MenuItems(0).MenuItems.Add("Verdana", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems(0).MenuItems.Add("Tahoma", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems(0).MenuItems.Add("Georgia", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Color", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Style", New System.EventHandler(AddressOf Me.MenuClick))
        menu.MenuItems.Add(item)
        Me.Menu = menu
        Dim cMenu As New ContextMenu()
        cMenu.MenuItems.Add("Copy", New System.EventHandler(AddressOf Me.EditCopy))
        cMenu.MenuItems.Add("Cut", New System.EventHandler(AddressOf Me.EditCut))
        cMenu.MenuItems.Add("Paste", New System.EventHandler(AddressOf Me.EditPaste))
        Me.TextBox1.ContextMenu = cMenu
    End Sub
    Sub MenuClick(ByVal sender As Object, ByVal e As System.EventArgs)
        MessageBox.Show("You selected the command " & sender.text & " of the File menu")
    End Sub
    Sub EditCopy(ByVal sender As Object, ByVal e As System.EventArgs)
        MessageBox.Show(sender.Text)
    End Sub
    Sub EditCut(ByVal sender As Object, ByVal e As System.EventArgs)
        MessageBox.Show(sender.Text)
    End Sub
    Sub EditPaste(ByVal sender As Object, ByVal e As System.EventArgs)
        MessageBox.Show(sender.Text)
    End Sub
    Sub FormatFont(ByVal sender As Object, ByVal e As System.EventArgs)
        MessageBox.Show(sender.Text)
    End Sub

End Class


Get Menu Structure

Imports System
Imports System.Drawing
Imports System.Reflection
Imports System.Windows.Forms
Imports System.IO

public class MainClass
   Shared Sub Main()
      Dim form1 As Form = New Form1
      Application.Run(form1)
   End Sub
End Class



Public Class Form1
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        "
        "Button1
        "
        Me.Button1.Font = New System.Drawing.Font("Verdana", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button1.Location = New System.Drawing.Point(4, 198)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(269, 37)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Show Menu Structure"
        "
        "TextBox1
        "
        Me.TextBox1.Font = New System.Drawing.Font("Verdana", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TextBox1.Location = New System.Drawing.Point(4, 6)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.TextBox1.Size = New System.Drawing.Size(272, 186)
        Me.TextBox1.TabIndex = 1
        Me.TextBox1.Text = ""
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(280, 257)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Button1})
        Me.Name = "Form1"
        Me.Text = "Menu Demo"
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim menu As New MainMenu()
        Dim item As MenuItem
        item = New MenuItem("File")
        item.MenuItems.Add("New", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Open", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Exit")
        " Add the top-level menu item to the MainMenu component 
        " and set the MainMenu component to be the form"s menu.
        menu.MenuItems.Add(item)
        item = New MenuItem("Edit")
        item.MenuItems.Add("Copy", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Cut", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Paste", New System.EventHandler(AddressOf Me.MenuClick))
        menu.MenuItems.Add(item)
        item = New MenuItem("Format")
        item.MenuItems.Add("Font")
        item.MenuItems(0).MenuItems.Add("Verdana", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems(0).MenuItems.Add("Tahoma", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems(0).MenuItems.Add("Georgia", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Color", New System.EventHandler(AddressOf Me.MenuClick))
        item.MenuItems.Add("Style", New System.EventHandler(AddressOf Me.MenuClick))
        menu.MenuItems.Add(item)
        Me.Menu = menu
        Dim cMenu As New ContextMenu()
        cMenu.MenuItems.Add("Copy", New System.EventHandler(AddressOf Me.MenuClick))
        cMenu.MenuItems.Add("Cut", New System.EventHandler(AddressOf Me.MenuClick))
        cMenu.MenuItems.Add("Paste", New System.EventHandler(AddressOf Me.MenuClick))
        Me.TextBox1.ContextMenu = cMenu
    End Sub
    Sub MenuClick(ByVal sender As Object, ByVal e As System.EventArgs)
        MsgBox("You selected the command " & sender.text & " of the File menu")
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim mItem As MenuItem
        TextBox1.Clear()
        For Each mItem In Me.Menu.MenuItems
            TextBox1.AppendText(mItem.Text & vbCrLf)
            ScanSubItems(mItem)
        Next
    End Sub
    Sub ScanSubItems(ByVal menuItem As MenuItem)
        Dim item As MenuItem
        Static identation As Integer
        identation += 1
        For Each item In menuItem.MenuItems
            TextBox1.AppendText(StrDup(identation, vbTab) & item.Text & vbCrLf)
            If item.IsParent Then ScanSubItems(item)
        Next
        identation -= 1
    End Sub
End Class


Menu action: Close a frame from

Imports System
Imports System.Collections
Imports System.ruponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class BaseForm
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    Friend WithEvents menuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents fileExitMenuItem As System.Windows.Forms.MenuItem
    Protected WithEvents statusBar As System.Windows.Forms.StatusBar
    Friend WithEvents menuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents helpAboutMenuItem As System.Windows.Forms.MenuItem
    Friend WithEvents mainMenu1 As System.Windows.Forms.MainMenu
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.menuItem1 = New System.Windows.Forms.MenuItem()
        Me.fileExitMenuItem = New System.Windows.Forms.MenuItem()
        Me.statusBar = New System.Windows.Forms.StatusBar()
        Me.menuItem3 = New System.Windows.Forms.MenuItem()
        Me.helpAboutMenuItem = New System.Windows.Forms.MenuItem()
        Me.mainMenu1 = New System.Windows.Forms.MainMenu()
        Me.SuspendLayout()
        "
        "menuItem1
        "
        Me.menuItem1.Index = 0
        Me.menuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.fileExitMenuItem})
        Me.menuItem1.Text = "&File"
        "
        "fileExitMenuItem
        "
        Me.fileExitMenuItem.Index = 0
        Me.fileExitMenuItem.Text = "E&xit"
        "
        "statusBar
        "
        Me.statusBar.Location = New System.Drawing.Point(0, 72)
        Me.statusBar.Name = "statusBar"
        Me.statusBar.Size = New System.Drawing.Size(176, 22)
        Me.statusBar.TabIndex = 1
        Me.statusBar.Text = "Ready"
        "
        "menuItem3
        "
        Me.menuItem3.Index = 1
        Me.menuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.helpAboutMenuItem})
        Me.menuItem3.Text = "&Help"
        "
        "helpAboutMenuItem
        "
        Me.helpAboutMenuItem.Index = 0
        Me.helpAboutMenuItem.Text = "&About..."
        "
        "mainMenu1
        "
        Me.mainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuItem1, Me.menuItem3})
        "
        "BaseForm
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(176, 94)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.statusBar})
        Me.Menu = Me.mainMenu1
        Me.Name = "BaseForm"
        Me.Text = "BaseForm"
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub fileExitMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles fileExitMenuItem.Click
        Me.Close()
    End Sub
    Private Sub helpAboutMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles helpAboutMenuItem.Click
        MessageBox.Show("Message?", "About")
    End Sub
End Class
Public Class MainClass
    Shared Sub Main()
        Dim myform As Form = New BaseForm()
        Application.Run(myform)
    End Sub
End Class


Menu action Demo

Imports System
Imports System.Collections
Imports System.Data
Imports System.IO
Imports System.Xml.Serialization
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Imports System.Drawing.Printing

Public Class MainClass
    Shared Sub Main()
       Dim form1 As Form = New Form1()
       Application.Run(form1) 
    End Sub
End Class

Public Class Form1
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
    Friend WithEvents File As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents mnuExit As System.Windows.Forms.MenuItem
    Friend WithEvents mnuOpen As System.Windows.Forms.MenuItem
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.Container
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.RichTextBox1 = New System.Windows.Forms.RichTextBox()
        Me.File = New System.Windows.Forms.MainMenu()
        Me.MenuItem1 = New System.Windows.Forms.MenuItem()
        Me.mnuOpen = New System.Windows.Forms.MenuItem()
        Me.mnuExit = New System.Windows.Forms.MenuItem()
        Me.SuspendLayout()
        "
        "RichTextBox1
        "
        Me.RichTextBox1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.RichTextBox1.Name = "RichTextBox1"
        Me.RichTextBox1.Size = New System.Drawing.Size(292, 269)
        Me.RichTextBox1.TabIndex = 0
        Me.RichTextBox1.Text = ""
        "
        "File
        "
        Me.File.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
        "
        "MenuItem1
        "
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuOpen, Me.mnuExit})
        Me.MenuItem1.Text = "File"
        "
        "mnuOpen
        "
        Me.mnuOpen.Index = 0
        Me.mnuOpen.Text = "&Open"
        "
        "mnuExit
        "
        Me.mnuExit.Index = 1
        Me.mnuExit.Text = "E&xit"
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
        Me.ClientSize = New System.Drawing.Size(292, 269)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.RichTextBox1})
        Me.Menu = Me.File
        Me.Name = "Form1"
        Me.Text = "Menu Example"
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
        Application.Exit()
    End Sub
    Private Sub mnuOpen_Click(ByVal sender As System.Object, _
       ByVal e As System.EventArgs) Handles mnuOpen.Click
     
     MessageBox.Show("Action")
    End Sub
End Class


Menu Item and Menu Action

Imports System.Windows.Forms
Imports System.Drawing
Imports System.IO

Module Module1
    Sub Main()
        Application.Run(New Form1)
    End Sub
End Module

Public Class Form1
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.MainMenu1 = New System.Windows.Forms.MainMenu()
        Me.MenuItem1 = New System.Windows.Forms.MenuItem()
        Me.MenuItem2 = New System.Windows.Forms.MenuItem()
        Me.MenuItem3 = New System.Windows.Forms.MenuItem()
        Me.MenuItem4 = New System.Windows.Forms.MenuItem()
        "
        "MainMenu1
        "
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2, Me.MenuItem3})
        "
        "MenuItem1
        "
        Me.MenuItem1.Index = 0
        Me.MenuItem1.Text = "File"
        "
        "MenuItem2
        "
        Me.MenuItem2.Index = 1
        Me.MenuItem2.Text = "Edit"
        "
        "MenuItem3
        "
        Me.MenuItem3.Index = 2
        Me.MenuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem4})
        Me.MenuItem3.Text = "Help"
        "
        "MenuItem4
        "
        Me.MenuItem4.Index = 0
        Me.MenuItem4.Text = "About"
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 49)
        Me.Menu = Me.MainMenu1
        Me.Name = "Form1"
        Me.Text = "MenuDemo"
    End Sub
#End Region
    Private Sub MenuItem1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
        MessageBox.Show("File menu")
    End Sub
    Private Sub MenuItem2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        MessageBox.Show("Edit menu")
    End Sub
    Private Sub MenuItem4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        MessageBox.Show("Help menu about option")
    End Sub
End Class


Owner Draw MenuItem

Imports System
Imports System.Drawing
Imports System.Reflection
Imports System.Windows.Forms
Imports System.IO

public class MainClass
   Shared Sub Main()
      Dim form1 As Form = New Form1
      Application.Run(form1)
   End Sub
End Class

Public Class Form1
    Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code"
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.Container
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    Friend WithEvents Red As System.Windows.Forms.MenuItem
    Friend WithEvents Green As System.Windows.Forms.MenuItem
    Friend WithEvents Blue As System.Windows.Forms.MenuItem
    Friend WithEvents Yellow As System.Windows.Forms.MenuItem
    Friend WithEvents Black As System.Windows.Forms.MenuItem
    Friend WithEvents White As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents AlignLeft As System.Windows.Forms.MenuItem
    Friend WithEvents AlignCenter As System.Windows.Forms.MenuItem
    Friend WithEvents AlignRight As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.MainMenu1 = New System.Windows.Forms.MainMenu()
        Me.MenuItem1 = New System.Windows.Forms.MenuItem()
        Me.Red = New System.Windows.Forms.MenuItem()
        Me.Green = New System.Windows.Forms.MenuItem()
        Me.Blue = New System.Windows.Forms.MenuItem()
        Me.Yellow = New System.Windows.Forms.MenuItem()
        Me.Black = New System.Windows.Forms.MenuItem()
        Me.White = New System.Windows.Forms.MenuItem()
        Me.MenuItem2 = New System.Windows.Forms.MenuItem()
        Me.AlignLeft = New System.Windows.Forms.MenuItem()
        Me.AlignCenter = New System.Windows.Forms.MenuItem()
        Me.AlignRight = New System.Windows.Forms.MenuItem()
        "
        "MainMenu1
        "
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2})
        "
        "MenuItem1
        "
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.Red, Me.Green, Me.Blue, Me.Yellow, Me.Black, Me.White})
        Me.MenuItem1.Text = "Color"
        "
        "Red
        "
        Me.Red.Index = 0
        Me.Red.OwnerDraw = True
        Me.Red.Text = ""
        "
        "Green
        "
        Me.Green.Index = 1
        Me.Green.OwnerDraw = True
        Me.Green.Text = ""
        "
        "Blue
        "
        Me.Blue.Index = 2
        Me.Blue.OwnerDraw = True
        Me.Blue.Text = ""
        "
        "Yellow
        "
        Me.Yellow.Index = 3
        Me.Yellow.OwnerDraw = True
        Me.Yellow.Text = ""
        "
        "Black
        "
        Me.Black.Index = 4
        Me.Black.OwnerDraw = True
        Me.Black.Text = ""
        "
        "White
        "
        Me.White.Index = 5
        Me.White.OwnerDraw = True
        Me.White.Text = ""
        "
        "MenuItem2
        "
        Me.MenuItem2.Index = 1
        Me.MenuItem2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.AlignLeft, Me.AlignCenter, Me.AlignRight})
        Me.MenuItem2.Text = "Alignment"
        "
        "AlignLeft
        "
        Me.AlignLeft.Index = 0
        Me.AlignLeft.OwnerDraw = True
        Me.AlignLeft.Text = "Left"
        "
        "AlignCenter
        "
        Me.AlignCenter.Index = 1
        Me.AlignCenter.OwnerDraw = True
        Me.AlignCenter.Text = "Center"
        "
        "AlignRight
        "
        Me.AlignRight.Index = 2
        Me.AlignRight.OwnerDraw = True
        Me.AlignRight.Text = "Right"
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 129)
        Me.Menu = Me.MainMenu1
        Me.Name = "Form1"
        Me.Text = "Owner-Drawn Menu"
    End Sub
#End Region
    Dim currentFont As Font
    Private Sub Red_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Red.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        e.Graphics.FillRectangle(Brushes.Red, R)
    End Sub
    Private Sub Red_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles Red.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(80, 18)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub Green_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles Red.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(80, 18)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub Green_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Green.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        e.Graphics.FillRectangle(Brushes.Green, R)
    End Sub
    Private Sub Blue_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles Blue.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(80, 18)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub Blue_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Blue.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        e.Graphics.FillRectangle(Brushes.Blue, R)
    End Sub
    Private Sub Yellow_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles Yellow.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(80, 18)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub Yellow_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Yellow.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        e.Graphics.FillRectangle(Brushes.Yellow, R)
    End Sub
    Private Sub White_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles White.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(80, 18)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub White_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles White.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        e.Graphics.FillRectangle(Brushes.White, R)
    End Sub
    Private Sub Black_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles Black.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(80, 18)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub Black_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Black.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        e.Graphics.FillRectangle(Brushes.Black, R)
    End Sub
    Private Sub AlignLeft_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles AlignLeft.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(40, 14)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub AlignLeft_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles AlignLeft.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        Dim strfmt As New StringFormat()
        strfmt.Alignment = StringAlignment.Near
        e.Graphics.DrawString("Left", Me.Font, Brushes.Black, R, strfmt)
    End Sub
    Private Sub AlignRight_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles AlignRight.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(40, 14)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub AlignRight_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles AlignRight.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        Dim strfmt As New StringFormat()
        strfmt.Alignment = StringAlignment.Far
        e.Graphics.DrawString("Right", Me.Font, Brushes.Black, R, strfmt)
    End Sub
    Private Sub AlignCenter_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles AlignCenter.MeasureItem
        Dim itemSize As SizeF
        itemSize = New SizeF(40, 14)
        e.ItemHeight = itemSize.Height
        e.ItemWidth = itemSize.Width
    End Sub
    Private Sub AlignCenter_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles AlignCenter.DrawItem
        Dim R As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        Dim strfmt As New StringFormat()
        strfmt.Alignment = StringAlignment.Center
        e.Graphics.DrawString("Center", Me.Font, Brushes.Black, R, strfmt)
    End Sub

    Private Sub Alignment_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlignCenter.Click, AlignLeft.Click, AlignRight.Click,Red.Click,Green.Click,Blue.Click,Yellow.Click,Black.Click,White.Click
        MessageBox.Show(sender.Text)
    End Sub
End Class


Owner draw Menu with selection highlight

Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public Class MainClass
    
    Shared Sub Main()
        Dim form1 As Form = New Form1
        Application.Run(form1)

    End Sub
End Class
Public Class Form1
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        "This call is required by the Windows Form Designer.
        InitializeComponent()
        "Add any initialization after the InitializeComponent() call
    End Sub
    "Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    "Required by the Windows Form Designer
    Private components As System.ruponentModel.IContainer
    "NOTE: The following procedure is required by the Windows Form Designer
    "It can be modified using the Windows Form Designer.  
    "Do not modify it using the code editor.
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents mnuFile As System.Windows.Forms.MenuItem
    Friend WithEvents mnuNew As System.Windows.Forms.MenuItem
    Friend WithEvents mnuOpen As System.Windows.Forms.MenuItem
    Friend WithEvents mnuSave As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.ruponents = New System.ruponentModel.Container()
        Me.MainMenu1 = New System.Windows.Forms.MainMenu()
        Me.mnuFile = New System.Windows.Forms.MenuItem()
        Me.mnuNew = New System.Windows.Forms.MenuItem()
        Me.mnuOpen = New System.Windows.Forms.MenuItem()
        Me.mnuSave = New System.Windows.Forms.MenuItem()
        "
        "MainMenu1
        "
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile})
        "
        "mnuFile
        "
        Me.mnuFile.Index = 0
        Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuNew, Me.mnuOpen, Me.mnuSave})
        Me.mnuFile.Text = "File"
        "
        "mnuNew
        "
        Me.mnuNew.Index = 0
        Me.mnuNew.OwnerDraw = True
        Me.mnuNew.Text = "New"
        "
        "mnuOpen
        "
        Me.mnuOpen.Index = 1
        Me.mnuOpen.OwnerDraw = True
        Me.mnuOpen.Text = "Open"
        "
        "mnuSave
        "
        Me.mnuSave.Index = 2
        Me.mnuSave.OwnerDraw = True
        Me.mnuSave.Text = "Save"
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Menu = Me.MainMenu1
        Me.Name = "Form1"
        Me.Text = "Owner-Drawn Menu"
    End Sub
#End Region
    Private Sub mnu_MeasureItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles mnuNew.MeasureItem, mnuOpen.MeasureItem, mnuSave.MeasureItem
        Dim mnuItem As MenuItem = CType(sender, MenuItem)
        Dim MenuFont As New Font("Tahoma", 8)
        e.ItemHeight = e.Graphics.MeasureString(mnuItem.Text, MenuFont).Height + 5
        e.ItemWidth = e.Graphics.MeasureString(mnuItem.Text, MenuFont).Width + 30
    End Sub
    Dim MenuImage As Image = New Bitmap("figure2.bmp")
    Private Sub mnu_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles mnuNew.DrawItem, mnuOpen.DrawItem, mnuSave.DrawItem
        Dim mnuItem As MenuItem = CType(sender, MenuItem)
        If e.State And DrawItemState.Selected = DrawItemState.Selected Then
            e.DrawBackground()
        End If
        e.Graphics.DrawImage(MenuImage, e.Bounds.Left + 3, e.Bounds.Top + 2)
        e.Graphics.DrawString(mnuItem.Text, e.Font, New SolidBrush(e.ForeColor), e.Bounds.Left + 25, e.Bounds.Top + 3)
    End Sub
End Class


Using menus to change font colors and styles

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Public Class MainClass
   Shared Sub Main()
        Dim myform As Form = New FrmMenu()
        Application.Run(myform)
   End Sub " Main
End Class
Public Class FrmMenu
   Inherits Form
#Region " Windows Form Designer generated code "
   Public Sub New()
      MyBase.New()
      "This call is required by the Windows Form Designer.
      InitializeComponent()
      "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
      If disposing Then
         If Not (components Is Nothing) Then
            components.Dispose()
         End If
      End If
      MyBase.Dispose(disposing)
   End Sub
   " display label
   Friend WithEvents lblDisplay As Label
   " main menu (contains file and format menus)
   Friend WithEvents mnuMainMenu As MainMenu
   " file menu 
   Friend WithEvents mnuFile As MenuItem
   Friend WithEvents mnuitmAbout As MenuItem
   Friend WithEvents mnuitmExit As MenuItem
   " format menu (contains format and font submenus)
   Friend WithEvents mnuFormat As MenuItem
   " color submenu
   Friend WithEvents mnuitmColor As MenuItem
   Friend WithEvents mnuitmBlack As MenuItem
   Friend WithEvents mnuitmBlue As MenuItem
   Friend WithEvents mnuitmRed As MenuItem
   Friend WithEvents mnuitmGreen As MenuItem
   " font submenu
   Friend WithEvents mnuitmFont As MenuItem
   Friend WithEvents mnuitmTimes As MenuItem
   Friend WithEvents mnuitmCourier As MenuItem
   Friend WithEvents mnuitmComic As MenuItem
   Friend WithEvents mnuitmDash As MenuItem
   Friend WithEvents mnuitmBold As MenuItem
   Friend WithEvents mnuitmItalic As MenuItem
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.Container
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
      Me.mnuitmItalic = New System.Windows.Forms.MenuItem()
      Me.mnuitmExit = New System.Windows.Forms.MenuItem()
      Me.mnuitmCourier = New System.Windows.Forms.MenuItem()
      Me.mnuitmBlue = New System.Windows.Forms.MenuItem()
      Me.mnuitmGreen = New System.Windows.Forms.MenuItem()
      Me.mnuMainMenu = New System.Windows.Forms.MainMenu()
      Me.mnuFile = New System.Windows.Forms.MenuItem()
      Me.mnuitmAbout = New System.Windows.Forms.MenuItem()
      Me.mnuFormat = New System.Windows.Forms.MenuItem()
      Me.mnuitmColor = New System.Windows.Forms.MenuItem()
      Me.mnuitmBlack = New System.Windows.Forms.MenuItem()
      Me.mnuitmRed = New System.Windows.Forms.MenuItem()
      Me.mnuitmFont = New System.Windows.Forms.MenuItem()
      Me.mnuitmTimes = New System.Windows.Forms.MenuItem()
      Me.mnuitmComic = New System.Windows.Forms.MenuItem()
      Me.mnuitmDash = New System.Windows.Forms.MenuItem()
      Me.mnuitmBold = New System.Windows.Forms.MenuItem()
      Me.lblDisplay = New System.Windows.Forms.Label()
      Me.SuspendLayout()
      "
      "mnuitmItalic
      "
      Me.mnuitmItalic.Index = 5
      Me.mnuitmItalic.Text = "Italic"
      "
      "mnuitmExit
      "
      Me.mnuitmExit.Index = 1
      Me.mnuitmExit.Text = "Exit"
      "
      "mnuitmCourier
      "
      Me.mnuitmCourier.Index = 1
      Me.mnuitmCourier.Text = "Courier"
      "
      "mnuitmBlue
      "
      Me.mnuitmBlue.Index = 1
      Me.mnuitmBlue.RadioCheck = True
      Me.mnuitmBlue.Text = "Blue"
      "
      "mnuitmGreen
      "
      Me.mnuitmGreen.Index = 3
      Me.mnuitmGreen.RadioCheck = True
      Me.mnuitmGreen.Text = "Green"
      "
      "mnuMainMenu
      "
      Me.mnuMainMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile, Me.mnuFormat})
      "
      "mnuFile
      "
      Me.mnuFile.Index = 0
      Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuitmAbout, Me.mnuitmExit})
      Me.mnuFile.Text = "File "
      "
      "mnuitmAbout
      "
      Me.mnuitmAbout.Index = 0
      Me.mnuitmAbout.Text = "About"
      "
      "mnuFormat
      "
      Me.mnuFormat.Index = 1
      Me.mnuFormat.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuitmColor, Me.mnuitmFont})
      Me.mnuFormat.Text = "Format"
      "
      "mnuitmColor
      "
      Me.mnuitmColor.Index = 0
      Me.mnuitmColor.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuitmBlack, Me.mnuitmBlue, Me.mnuitmRed, Me.mnuitmGreen})
      Me.mnuitmColor.Text = "Color"
      "
      "mnuitmBlack
      "
      Me.mnuitmBlack.Index = 0
      Me.mnuitmBlack.RadioCheck = True
      Me.mnuitmBlack.Text = "Black"
      "
      "mnuitmRed
      "
      Me.mnuitmRed.Index = 2
      Me.mnuitmRed.RadioCheck = True
      Me.mnuitmRed.Text = "Red"
      "
      "mnuitmFont
      "
      Me.mnuitmFont.Index = 1
      Me.mnuitmFont.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuitmTimes, Me.mnuitmCourier, Me.mnuitmComic, Me.mnuitmDash, Me.mnuitmBold, Me.mnuitmItalic})
      Me.mnuitmFont.Text = "Font"
      "
      "mnuitmTimes
      "
      Me.mnuitmTimes.Index = 0
      Me.mnuitmTimes.Text = "Times New Roman"
      "
      "mnuitmComic
      "
      Me.mnuitmComic.Index = 2
      Me.mnuitmComic.Text = "Comic Sans"
      "
      "mnuitmDash
      "
      Me.mnuitmDash.Index = 3
      Me.mnuitmDash.Text = "-"
      "
      "mnuitmBold
      "
      Me.mnuitmBold.Index = 4
      Me.mnuitmBold.Text = "Bold"
      "
      "lblDisplay
      "
      Me.lblDisplay.Font = New System.Drawing.Font("Times New Roman", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
      Me.lblDisplay.Location = New System.Drawing.Point(8, 8)
      Me.lblDisplay.Name = "lblDisplay"
      Me.lblDisplay.Size = New System.Drawing.Size(290, 48)
      Me.lblDisplay.TabIndex = 0
      Me.lblDisplay.Text = "www.vbex.ru"
      "
      "FrmMenu
      "
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.ClientSize = New System.Drawing.Size(256, 121)
      Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblDisplay})
      Me.Menu = Me.mnuMainMenu
      Me.Name = "FrmMenu"
      Me.Text = "MenuTest"
      Me.ResumeLayout(False)
   End Sub
#End Region
   Private Sub mnuitmAbout_Click _
      (ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmAbout.Click
      MessageBox.Show("This is an example" & vbCrLf & _
         "of using menus.", "About", MessageBoxButtons.OK, _
         MessageBoxIcon.Information)
   End Sub 
   " exit program
   Private Sub mnuitmExit_Click _
      (ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmExit.Click
      Application.Exit()
   End Sub " mnuitmExit_Click
   Private Sub ClearColor()
      mnuitmBlack.Checked = False
      mnuitmBlue.Checked = False
      mnuitmRed.Checked = False
      mnuitmGreen.Checked = False
   End Sub " ClearColor
   Private Sub mnuitmBlack_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmBlack.Click
      ClearColor()
      lblDisplay.ForeColor = Color.Black
      mnuitmBlack.Checked = True
   End Sub " mnuitmBlack_Click
   Private Sub mnuitmBlue_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmBlue.Click
      ClearColor()
      lblDisplay.ForeColor = Color.Blue
      mnuitmBlue.Checked = True
   End Sub
   Private Sub mnuitmRed_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmRed.Click
      ClearColor()
      lblDisplay.ForeColor = Color.Red
      mnuitmRed.Checked = True
   End Sub " mnuitmRed_Click
   Private Sub mnuitmGreen_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmGreen.Click
      ClearColor()
      lblDisplay.ForeColor = Color.Green
      mnuitmGreen.Checked = True
   End Sub " mnuitmGreen_Click
   Private Sub ClearFont()
      mnuitmTimes.Checked = False
      mnuitmCourier.Checked = False
      mnuitmComic.Checked = False
   End Sub " ClearFont
   Private Sub mnuitmTimes_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmTimes.Click
      ClearFont()
      mnuitmTimes.Checked = True
      lblDisplay.Font = New Font("Times New Roman", 30, _
         lblDisplay.Font.Style)
   End Sub " mnuitmTimes_Click
   Private Sub mnuitmCourier_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmCourier.Click
      ClearFont()
      mnuitmCourier.Checked = True
      lblDisplay.Font = New Font("Courier New", 30, _
         lblDisplay.Font.Style)
   End Sub " mnuitmCourier_Click
   Private Sub mnuitmComic_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmComic.Click
      ClearFont()
      mnuitmComic.Checked = True
      lblDisplay.Font = New Font("Comic Sans MS", 30, _
         lblDisplay.Font.Style)
   End Sub " mnuitmComic_Click 
   Private Sub mnuitmBold_Click _
      (ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmBold.Click
      mnuitmBold.Checked = Not mnuitmBold.Checked
      lblDisplay.Font = New Font _
         (lblDisplay.Font.FontFamily, 30, _
         lblDisplay.Font.Style Xor FontStyle.Bold)
   End Sub " mnuitmBold_Click
   Private Sub mnuitmItalic_Click _
      (ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles mnuitmItalic.Click
      mnuitmItalic.Checked = Not mnuitmItalic.Checked
      lblDisplay.Font = New Font _
         (lblDisplay.Font.FontFamily, 30, _
         lblDisplay.Font.Style Xor FontStyle.Italic)
   End Sub
End Class