Dr Dat Tran - Week 4 Lecture Notes 1 ToolStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &

Slides:



Advertisements
Similar presentations
A window application ---to know Dialogs (Week 7) ~csdywang/ta.htm.
Advertisements

Information System Design Lab 5&6. User Interface Design.
 2007 Dr. Natheer Khasawneh. Chapter 13. Graphical User Interface Concepts: Part 1.
Copyright © 2012 Pearson Education, Inc. Chapter 11 MORE WINDOWS CONTROLS & STANDARD DIALOG BOXES.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
C# Programming: From Problem Analysis to Program Design1 9 Programming Based on Events.
C# Programming: From Problem Analysis to Program Design1 Programming Based on Events C# Programming: From Problem Analysis to Program Design 3 rd Edition.
.NET Class 4 – Windows-based Application. WinForm Application Homogeny programming model. Rich class library Classes are shared by all.NET languages.
Graphical User Interface (GUI) A GUI allows user to interact with a program visually. GUIs are built from GUI components. A GUI component is an object.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
BİL528 – Bilgisayar Programlama II Advanced Controls, Menus, Toolbars, and Status Bars 1.
DT265-2 Object Oriented Software Development 2 Lecture 3 : Windows Programming Lecturer Pat Browne
1 Windows Printing. 2 Objectives You will be able to Output text and graphics to a printer. Print multipage documents. Use the standard Windows print.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Dr Dat Tran - Week 4 Lecture Notes 1 MenuStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Object Oriented Programming Graphical User Interfaces Dr. Mike Spann
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures.
WINDOWS Part 1 – Start Up Basics
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.
Dr Dat Tran - Week 1 Lecture Notes 1 Windows Forms Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences.
CST238 Week 4 Questions / Concerns? Announcements – Start thinking about project ideas – Test#1 next Monday, 4/28/14 Recap Check-off Take Home Lab#3 New.
G RAPHICAL U SER I NTERFACE C ONCEPTS : P ART 1 1 Outline Introduction Windows Forms Event-Handling Model - Basic Event Handling.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
BIL528 – Bilgisayar Programlama II Introduction 1.
Sample Application Multi Layered Architecture (n-tier): –Graphical User Interface (GUI): Forms, components, controls The Visual Designer in Visual Studio.
How to Create a Document in Google Drive By Tressa Beckler.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
GUI Design With The Appx Client Presented By: Gary Rogers.
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.
Windows Presentation Foundation (WPF). Introduction Separates appearance of user interface from behavior Appearance usually specified by XAML Behavior.
OneNote 2007 Adding text and images from the web.
Lecture 7 Dialog Controls MDI Parent/Child Interaction.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Developing Windows Applications with Visual Studio Windows Forms Controls and Coding Jim Warren – COMPSCI 280 S Enterprise.
Dr Dat Tran - Week 2 Lecture Notes 1 Forms Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences & Engineering.
Copyright © 2012 Pearson Education, Inc. Chapter 5 Loops, File, and Random Numbers.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
1 Printing a Document. 2 Objectives You will be able to print a real multipage document.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
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.
Prepared by the Academic Faculty Members of IT. Tables Creating Tables. Merging Cells. Splitting Cells. Sorting Tables. Performing Calculations.
Word 2010 Text Basics In this lesson you'll learn the basics of working with text, including how to insert, delete, select, copy, cut, paste, and replace.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Building a Simple Text Editor. Create a text editor with the following features: (1) Uses a MenuStrip with File, and Edit tabs (2) The user can create.
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.
Lessons Copy and Paste Text Drag and Drop Text 2-Saving Documents 3- Printing 4-Inserting Tables Modifying Page Layout Format Page Margins Insert a Blank.
Module 3: Creating Windows-based Applications. Overview Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog.
Dive Into® Visual Basic 2010 Express
Computing with C# and the .NET Framework
Customizing the Quick Access Toolbar in Microsoft Office
How to Add Images Using an 'openFile' Dialog
The University of Texas – Pan American
Creating a Windows Forms User Interface
Self Study GUI Properties & Events
Module 8: Creating Windows-based Applications
Lecture 5 Menu Strip Demo with Dialog Controls.
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

Dr Dat Tran - Week 4 Lecture Notes 1 ToolStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences & Engineering

Dr Dat Tran - Week 4 Lecture Notes 2 ToolStrip ToolStrip class is a ToolStrip class is abstract base class for MenuStrip, StatusStrip, and ContextMenuStrip ToolStrip control provides many members that manage painting, mouse and keyboard input, and drag-and-drop functionality Use ToolStrip controls to create toolbars that have a WindowsXP appearance with support for overflow and run- time item reordering ToolStrip controls handle events consistently for all containers and contained items, in the same way you handle events for other controls. You can drag items from one ToolStrip to another or within a ToolStrip

Dr Dat Tran - Week 4 Lecture Notes 3 A Simple Text Editor We use an MDI form and a ToolStrip control to build a simple text editor. The ToolStrip control contains standard items such as New, Open, Save, Cut, Copy, Paste, and Print Implementation code is also added to implement the standard items

Dr Dat Tran - Week 4 Lecture Notes 4 1. Add ToolStrip to Form drag & drop rename it

Dr Dat Tran - Week 4 Lecture Notes 5 2. Insert Standard Items click click

Dr Dat Tran - Week 4 Lecture Notes 6 3. Change Render Mode click

Dr Dat Tran - Week 4 Lecture Notes 7 4. Create Event Handlers double-click each item

Dr Dat Tran - Week 4 Lecture Notes 8 5. Change the Form to MDI Form

Dr Dat Tran - Week 4 Lecture Notes 9 6. Add Implementation Code int count; Form mdiChild; TextBox editTextBox; public MyNotePad() { InitializeComponent(); InitializeComponent(); count = 1; count = 1;}

Dr Dat Tran - Week 4 Lecture Notes The New Item private void newToolStripButton_Click(object sender, EventArgs e) { mdiChild = new Form(); mdiChild = new Form(); mdiChild.Text = "Document" + mdiChild.Text = "Document" +count.ToString(); mdiChild.MdiParent = this; mdiChild.MdiParent = this; editTextBox = new TextBox(); editTextBox = new TextBox(); editTextBox.Multiline = true; editTextBox.Multiline = true; editTextBox.Dock = DockStyle.Fill; editTextBox.Dock = DockStyle.Fill; mdiChild.Controls.Add(editTextBox); mdiChild.Controls.Add(editTextBox); mdiChild.Show(); mdiChild.Show(); count++; count++;}

Dr Dat Tran - Week 4 Lecture Notes Test the New Item click editTextBox.Dock = DockStyle.Fill; DockStyle.Fill;

Dr Dat Tran - Week 4 Lecture Notes The Cut Item private void cutToolStripButton_Click( object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox) activeChildForm.ActiveControl; if (activeTextBox != null) activeTextBox.Cut(); }

Dr Dat Tran - Week 4 Lecture Notes The Copy Item private void copyToolStripButton_Click( object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox) activeChildForm.ActiveControl; if (activeTextBox != null) activeTextBox.Copy(); }

Dr Dat Tran - Week 4 Lecture Notes The Paste Item private void pasteToolStripButton_Click( object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox) activeChildForm.ActiveControl; if (activeTextBox != null) activeTextBox.Paste(); }

Dr Dat Tran - Week 4 Lecture Notes Test the Cut, Copy and Paste Items click

Dr Dat Tran - Week 4 Lecture Notes The Save Item private void saveToolStripButton_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = "Save a Text File"; sfd.Filter = "Text File (*.txt)|*.txt|All Files (*.*)|*.*"; DialogResult dr = sfd.ShowDialog(); if (dr == DialogResult.OK) {

Dr Dat Tran - Week 4 Lecture Notes 17 System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName); Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox) activeChildForm.ActiveControl; if (activeTextBox != null) sw.Write(activeTextBox.Text); sw.Close(); }

Dr Dat Tran - Week 4 Lecture Notes The Open Item private void openToolStripButton_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Open a Text File"; ofd.Filter = "Text File (*.txt)|*.txt|All Files (*.*)|*.*"; DialogResult dr = ofd.ShowDialog(); if (dr == DialogResult.OK) {

Dr Dat Tran - Week 4 Lecture Notes 19 System.IO.StreamReader sr = new System.IO.StreamReader(ofd.FileName); Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox) activeChildForm.ActiveControl; if (activeTextBox != null) activeTextBox.Text = sr.ReadToEnd(); sr.Close(); }

Dr Dat Tran - Week 4 Lecture Notes The Print Item private void printToolStripButton_Click(object sender, EventArgs e) { PrintDialog pd = new PrintDialog(); pd.ShowDialog(); } // Display Print dialog only // Cannot print

Dr Dat Tran - Week 4 Lecture Notes 21 Add Other Controls to ToolStrip We can add more controls to the ToolStrip such as –Button –Label –Split Button –DropDownButton –Separator –ComboBox –TextBox –ProgressBar

Dr Dat Tran - Week 4 Lecture Notes 22 Available Controls for ToolStrip

Dr Dat Tran - Week 4 Lecture Notes 23 Add Split Button and Its Sub-Items Change image for the split button