Write a Vb.net program to design the following form, it contains the three menus Color (Red,Blue,Green) ,Window(Maximize, Minimize, Restore) and Exit. On Selection of any menu or submenu result should affect the form control( for example if user selected Red color from Color menu back color of form should get changed to Red and if user selected Maximize from Window Menu then form should get maximized).

 Form:- 

Program:-

Public Class slip16

    Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click

        Me.Close()

    End Sub


    Private Sub RedToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RedToolStripMenuItem.Click

        Me.BackColor = Color.Red

    End Sub


    Private Sub BlueToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BlueToolStripMenuItem.Click

        Me.BackColor = Color.Blue

    End Sub


    Private Sub GreenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GreenToolStripMenuItem.Click

        Me.BackColor = Color.Green

    End Sub


    Private Sub ToolStripMenuItem2_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem2.Click

        Me.Close()

    End Sub


    Private Sub MaximizedToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MaximizedToolStripMenuItem.Click

        Me.WindowState = FormWindowState.Maximized

    End Sub


    Private Sub MinimizedToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MinimizedToolStripMenuItem.Click

        Me.WindowState = FormWindowState.Minimized

    End Sub


    Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem1.Click

        Me.WindowState = FormWindowState.Normal

    End Sub

End Class

Output:-



Design:-

1) Take MenuStrip on  Design form.

2) Write all options on MenuStrip.



0 Comments