Total members 11893 |It is currently Wed Nov 06, 2024 3:50 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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.




Author:
Newbie
User avatar Posts: 2
Have thanks: 0 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); 
 
    
// Create File submenu 
    
MenuItem subfileMenuIteam = new MenuItem("Open File"); 
    
fileMenuIteam.MenuItems.Add(subfileMenuIteam); 
 
    
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(); 
 
    
Application.Run(formObj); 
  } 
 
  
 
  
// Change action 
  
protected void changeClick(object whoEventArgs e) { 
   
// change size of window
    
Width Height 300
  } 
 
  
// restore action
  
protected void restoreClick(object whoEventArgs e) { 
   
// restore size of window
    
Width Height 400
  } 
 
  
// open selection handling
  
protected void openClick(object whoEventArgs e) { 
 
    
MessageBox.Show("not implemented""not implemented"
                    
MessageBoxButtons.OK); 
  } 
 
  
//  close  click handling
  
protected void closeClick(object whoEventArgs e) { 
 
    
MessageBox.Show("not implemented""not implemented"
                    
MessageBoxButtons.OK); 
  } 
 
  
// exit with confirmation .
  
protected void exitClick(object whoEventArgs e) { 
 
    
DialogResult answer MessageBox.Show("Are you sure you want to exit"
                            
"Exit"
                             
MessageBoxButtons.YesNo); 
 
    if(
answer == DialogResult.YesApplication.Exit(); 
  } 
}

 


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Working with menus, Label links and files in C#
 Working with menus, Label links and files in C#     -  
 Label Alignment example     -  
 SSI.php on other websites, Not working     -  
 javap is not working     -  
 working of bitwise ~ operator     -  
 HELP: JAVA not working in TEXTPAD     -  
 video conference is nt working     -  
 Working on hotel class     -  
 ScrollableTable is not working in the firefox     -  
 jsp include directive not working     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com