Question subject: Working with menus, Label links and files in C#
Posted: Wed Apr 06, 2011 10:23 am
Joined: Wed Mar 30, 2011 6:30 am Posts: 3 Has thanked: 0 time Have thanks: 0 time
hi, my mentor has asked me to design a form similar to the My Computer Window. am just confused as i dont know how to add those menus and the whole form on the left side.the colored strip with System tasks, other places, details and how they are linked to certain forms and windows like the view system info takes you to the system information window. deadline is Friday noon.
msi_333
Question subject: Re: Working with menus, Label links and files in C#
Posted: Wed Apr 06, 2011 10:39 pm
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2277 Location: Earth Has thanked: 39 time Have thanks: 61 time
code may help . Form with menu bar .
Code:
using System; using System.Windows.Forms;
public class testForm : Form { MainMenu menubarObj;
public testForm() { Text = "Adding a Main Menu";
// Create a main menu object. menubarObj = new MainMenu();
// Add top-level menu items to the menu. MenuItem fileMenuIteam = new MenuItem("File"); menubarObj.MenuItems.Add(fileMenuIteam);
MenuItem toolMenuIteam = new MenuItem("Tools"); menubarObj.MenuItems.Add(toolMenuIteam);
MenuItem subtoolMenuIteam = new MenuItem("Close"); fileMenuIteam.MenuItems.Add(subtoolMenuIteam);
MenuItem exitIteam = new MenuItem("Exit"); fileMenuIteam.MenuItems.Add(exitIteam);
MenuItem changeIteam = new MenuItem("Change size"); toolMenuIteam.MenuItems.Add(changeIteam);
MenuItem restoreIteam = new MenuItem("Restore size"); toolMenuIteam.MenuItems.Add(restoreIteam);
// events call back function subfileMenuIteam.Click += new EventHandler(openClick); subtoolMenuIteam.Click += new EventHandler(closeClick); exitIteam.Click += new EventHandler(exitClick);
changeIteam.Click += new EventHandler(changeClick); restoreIteam.Click += new EventHandler(restoreClick);
// set the menu of the form Menu = menubarObj; }
[STAThread] public static void Main() { testForm formObj = new testForm();