Total members 10259 | Gratitudes |It is currently Mon May 21, 2012 2:57 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: Working with menus, Label links and files in C#
PostPosted: Wed Apr 06, 2011 10:23 am 
Offline
Newbie
User avatar

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.


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Working with menus, Label links and files in C#
PostPosted: Wed Apr 06, 2011 10:39 pm 
Offline
Mastermind
User avatar

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); 
 
    
// 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(); 
  } 
}

 

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  

 Similar topics
 Uplading Files Dynamically Using SSIS
 Code to open multiple links.
 ScrollableTable is not working in the firefox
 links CSS properties
 Many links for the one image
 script for including files
 How to download and save .mov files from this website ?
 HELP: JAVA not working in TEXTPAD
 Example of using access key with links
 background-image Anchor in header links

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team