Graphical User Interfaces Part 2

Slides:



Advertisements
Similar presentations
Using Macros and Visual Basic for Applications (VBA) with Excel
Advertisements

110-H1 More VB Tools Creating a Menu: What is a menu? a group of (related) commands displayed at at the top of an application Top level menu Disabled command.
C# Programming: From Problem Analysis to Program Design1 Programming Based on Events C# Programming: From Problem Analysis to Program Design 3 rd Edition.
GUI Concepts - 3. Menus Creating Other Forms Visual Inheritance Outline.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Creating Menu. Objectives Create a menu system for a form –Create a menu –Create a menu titles –Create a menu items –Create a submenu –Modify menu –Edit.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Chapter 8: String Manipulation
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
1 Graphical User Interfaces Part 2 Outline Multiple Document Interface (MDI) Windows Visual Inheritance User-Defined Controls.
Dr Dat Tran - Week 4 Lecture Notes 1 MenuStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
1 Graphical User Interfaces Part 2 Outline ListBoxes and CheckedListBoxes ListBoxes CheckedListBoxes ComboBoxes.
IE 411/511: Visual Programming for Industrial Applications
Chapter 12: Using Controls. Examining the IDE’s Automatically Generated Code A new Windows Forms project has been started and given the name FormWithALabelAndAButton.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
1 Working with Menus and Dialog Boxes. 2 Objectives You will be able to Create and edit menus for Windows Forms applications. Write code to handle menu.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 – Graphical User Interfaces Part 2 Outline.
C # Graphical User Interfaces BIT-7 Saad Liaquat.
Graphical User Interface Concepts - Part 2 Session 09 Mata kuliah: M0874 – Programming II Tahun: 2010.
Copyright © 2010 Wolters Kluwer Health | Lippincott Williams & Wilkins Introduction to Windows Chapter 2.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
 2002 Prentice Hall. All rights reserved. 1 Chapter 13 – Graphical User Interfaces Part 2 Outline 13.1 Introduction 13.2 Menus 13.3 LinkLabels 13.4 ListBoxes.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Chapter 2 – Introduction to the Visual Studio .NET IDE
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 2.1 Test-Driving the Welcome Application 2.2.
 2002 Prentice Hall. All rights reserved. 1 Chapter 13 – Graphical User Interfaces Part 2 Outline 13.1 Introduction 13.2 Menus 13.3 LinkLabels 13.4 ListBoxes.
Menus Menus provide groups of related commands for windows applications Menu, menu items, submenus A menu item that contains a submenu is considered to.
Compunet Corporation Programming with Visual Basic.NET Working with Menus and Dialog Boxes Week 14 Tariq Aziz and Kevin Jones.
Graphical User Interface Components Version 1.1. Obectives Students should understand how to use these basic Form components to create a Graphical User.
Jozef Goetz contribution,  Pearson Education, Inc. All rights reserved.  2002 Prentice Hall. All rights reserved.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
Visual Basic.NET BASICS Lesson 14 Menus and Printing.
Graphical User Interfaces Part 2 1 Outline TreeViews ListViews Tab Control.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
Project 1 Creating a Dreamweaver Web Page and Local Site.
Dive Into® Visual Basic 2010 Express
Graphical User Interface
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Chapter 13 – Graphical User Interfaces Part 2
Chapter 1: An Introduction to Visual Basic 2015
Creating Links – Lesson 3
Chapter 2 – Introduction to the Visual Studio .NET IDE
An Introduction to Computers and Visual Basic
Metadata Editor Introduction
Microsoft Windows XP Inside Out Second Edition
Introduction to the Visual C# 2005 Express Edition IDE
An Introduction to Computers and Visual Basic
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Chapter 2 Visual Basic Interface
How to customize your Microsoft SharePoint Online website
Chapter 1 Editing a Photo
Module 6: Creating Web Pages and Working with Channels
How to customize your Microsoft SharePoint Online website
Windows Internet Explorer 7-Illustrated Essentials
Chapter 2 – Introduction to the Visual Studio .NET IDE
Windows Forms GUI: A Deeper Look
How to customize your Microsoft SharePoint Online website
Visual programming Chapter 4: GUI (Graphical User Interface) Part II
Visual Studio.
An Introduction to Computers and Visual Basic
Module 8: Creating Windows-based Applications
Using Windows XP Explorer
DREAMWEAVER 8 Creating a Dreamweaver Web Page and Local Site.
Chapter 4 Enhancing the Graphical User Interface
Presentation transcript:

Graphical User Interfaces Part 2 Outline Introduction Menus LinkLabels

Continues study of Graphical User Interface Explores: Introduction Continues study of Graphical User Interface Explores: Menus LinkLabels

Menus Menu Disabled command Separator bar Checked menu item Shortcut key Menu submenu Disabled command Separator bar Checked menu item Expanded and checked menus.

Group related commands together Contain: Menus Group related commands together Contain: Commands Submenus Some commends, such as Exit are common to many applications and uses Application class to quit To create a menu drag a MenuStrip control onto form. Creates a menu bar on top of the form and an icon beneath it Click the icon Menu Designer Every option has its own event handler

Menus Place & character before the letter to be underlined Text boxes used to add items to menu Menu Designer MainMenu icon Visual Studio .NET Menu Designer.

Menus Default Event MenuStrip Properties Menu Item Properties MenuItems RightToLeft Menu Item Properties Text Index (position in parent list) ShortCutKeys and ShowShortCutKeys MenuItems (for a submenu) Checked (according to property RadioCheck - default is false) MergeAction (Append, Insert, Remove and Replace) MergeIndex(set position of menu item when menus are merged) Default Event Click – generated when item is clicked or shortcut key is used

11 public class MenuTest : System.Windows.Forms.Form 12 { 12 { 13 // display label 14 private System.Windows.Forms.Label displayLabel; 15 16 // main menu (contains file and format menu) 17 private System.Windows.Forms.MainMenu mainMenu; 18 19 // file menu 20 private System.Windows.Forms.MenuItem fileMenuItem; 21 private System.Windows.Forms.MenuItem aboutMenuItem; 22 private System.Windows.Forms.MenuItem exitMenuItem; 23 24 // format menu 25 private System.Windows.Forms.MenuItem formatMenuItem; 26 27 // color submenu 28 private System.Windows.Forms.MenuItem colorMenuItem; 29 private System.Windows.Forms.MenuItem blackMenuItem; 30 private System.Windows.Forms.MenuItem blueMenuItem; 31 private System.Windows.Forms.MenuItem redMenuItem; 32 private System.Windows.Forms.MenuItem greenMenuItem; options

private void aboutMenuItem_Click( object sender, System.EventArgs e ) // display MessageBox private void aboutMenuItem_Click( object sender, System.EventArgs e ) { MessageBox.Show( "This is an example\nof using menus.", "About", MessageBoxButtons.OK, MessageBoxIcon.Information ); } // exit program private void exitMenuItem_Click( Application.Exit(); About event handler Exit event Handler

private void ClearColor() { // clear all checkmarks // reset color private void ClearColor() { // clear all checkmarks blackMenuItem.Checked = false; blueMenuItem.Checked = false; redMenuItem.Checked = false; greenMenuItem.Checked = false; } // update menu state and color display black private void blackMenuItem_Click( object sender, System.EventArgs e ) // reset checkmarks for color menu items ClearColor(); // set color to black displayLabel.ForeColor = Color.Black; blackMenuItem.Checked = true; Black event handler

Displays links to other objects LinkLabels Displays links to other objects Uses event handlers to link to right file or program Start method of Process class opens other programs Derived from class Label, inherits functionality

LinkLabels LinkLabel on a form Hand image displayed when mouse cursor over a LinkLabel LinkLabel control in the design phase and in running program.

LinkLabels Properties Event Text LinkArea – portion of text treated as link LinkBehavior – how link appears when mouse is over it LinkColor (before visit - default is blue) ActiveLinkColor (when link clicked – default is red) VisitedLinkColor (default is purple) LinkVisited Links (lists the LinkLabel.Link objects) Event LinkClicked (default)

Click on first LinkLabel to look at contents of C drive

Click on second LinkLabel to go to the Web Site

Click the third LinkLabel to open notepad

public partial class LinkLabelTest : Form { // linklabels to C: drive, www.deitel.com and Notepad private System.Windows.Forms.LinkLabel driveLinkLabel; private System.Windows.Forms.LinkLabel deitelLinkLabel; private System.Windows.Forms.LinkLabel notepadLinkLabel; // browse C:\ drive private void driveLinkLabel_LinkClicked( object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e ) driveLinkLabel.LinkVisited = true; System.Diagnostics.Process.Start( "C:\\" ); } C drive link Deitel website link Notepad link C drive event handler Start method to open other programs

// load www.deitel.com in Web broswer private void deitelLinkLabel_LinkClicked( object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e ) { deitelLinkLabel.LinkVisited = true; System.Diagnostics.Process.Start( "IExplore", "http://www.deitel.com" ); } // run application Notepad private void notepadLinkLabel_LinkClicked( object sender, notepadLinkLabel.LinkVisited = true; // program called as if in run // menu and full path not needed System.Diagnostics.Process.Start( "notepad" ); Deitel website event handler Notepad event handler