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

Slides:



Advertisements
Similar presentations
 2007 Dr. Natheer Khasawneh. Chapter 13. Graphical User Interface Concepts: Part 1.
Advertisements

Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 1 Tariq Aziz and Kevin Jones.
Compunet Corporation Programming with Visual Studio.NET GUI Week 13 Tariq Aziz and Kevin Jones.
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.
MDI windows Single-document-interface (SDI)
Multiple Document Interface (MDI) application
Compunet Corporation Programming with Visual Basic.NET GUI Week # 11 Tariq Ibn Aziz.
Chapter 13: Advanced GUI and Graphics
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 &
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Multiple Forms and Standard Modules
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
MDI vs. SDI MDI – Multiple Document Interface SDI – Single Document Interface In an SDI application, each form acts independently of the others. A MDI.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
Object Oriented Programming Graphics and Multimedia Dr. Mike Spann
BIM211 – Visual Programming Objects, Collections, and Events 1.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Dr Dat Tran - Week 1 Lecture Notes 1 Windows Forms Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences.
Dr Dat Tran - Week 4 Lecture Notes 1 ToolStrip 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.
File I/O 11_file_processing.ppt
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 – Graphical User Interfaces Part 2 Outline.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
COS240 O-O Languages AUBG, COS dept Lecture 33 Title: C# vs. Java (GUI Programming) Reference: COS240 Syllabus.
VB.NET Additional Topics
BIL528 – Bilgisayar Programlama II Introduction 1.
Lecture 6: Introduction to Graphical User Interfaces (GUIs)
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
Chapter Two Creating a First Project in Visual Basic.
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.
C# GUI - Basics. Objectives.NET supports two types: WinForms, traditional, desktop GUI apps. WebForms – newer, for Web apps. Visual Studio.NET supports.
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.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Creating a Multiple-Form Interface.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Understanding Desktop Applications Lesson 5. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Windows Forms Applications Understand.
CPSC 481 – Week #7 Sowmya Somanath
1NetBeans Tutorial Using the “Properties” menu, name the List “List1” and the button “Button1”. NetBeans Tutorial6.
CECS 5020 Computers in Education Forms and Menus.
Lecture Set 7 Procedures and Event Handlers Part B - The Structure of an Application Event Handlers.
Graphical User Interface Components Version 1.1. Obectives Students should understand how to use these basic Form components to create a Graphical User.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 2 Creating Applications with Visual Basic.
Understanding Desktop Applications Lesson 5. Understanding Windows Forms Applications Windows Forms applications are smart client applications consisting.
1 15. Building Applications with Windows Forms Why Use Windows Forms? Structure of Windows Forms Using Windows Forms Using Controls Code Samples.
1 Working with Controls at Run Time. 2 Objectives You will be able to Add controls to a Windows form at run time. Modify controls at run time.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
Windows form programming. namespace MyNamespace { public class MyForm : System.Windows.Forms.Form { public MyForm() { this.Text = "Hello Form"; }
GUI Programming Prepared by: Ahmad Ramin Rahimee Assistant Professor ICTI.
Module 3: Creating Windows-based Applications. Overview Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog.
SDI & MDI SDI -> Single Document Interface
Computing with C# and the .NET Framework
Standard Controls.
Multi-form applications and dialogs
Copyright © 2006 Thomas P. Skinner
Extend Text Editor to Draw shapes
Lecture Set 11 Creating and Using Classes
Module 8: Creating Windows-based Applications
6. WinForms 2003 C# GUI - Basics.
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 2 Lecture Notes 1 Forms Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences & Engineering

Dr Dat Tran - Week 2 Lecture Notes 2 Create a Shape Form public TestForm () { InitializeComponent(); System.Drawing.Drawing2D.GraphicsPath shape = new System.Drawing.Drawing2D.GraphicsPath(); shape.AddEllipse(0, 0, this.Width, this.Height); this.Region = new System.Drawing.Region(shape); }

Dr Dat Tran - Week 2 Lecture Notes 3 Get a Value from Another Form In Form 1 private Form2 form2 = new Form2(); private void GetLabelControlInForm2() { label1.Text = form2.Label2.Text; } In Form 2 public Label Label2 { get { return label2; }

Dr Dat Tran - Week 2 Lecture Notes 4 Form Events Load: Occurs before a form is displayed for the first time Activate: Occurs when the form is activated in code or by the user Deactivate: Occurs when the form loses focus and is no longer the active form Closing: Occurs when the form is closing Closed: Occurs when the form is closed Shown: Occurs whenever the form is first displayed SizeChanged: Occurs when the Size property value changes

Dr Dat Tran - Week 2 Lecture Notes 5 Create a Form Event Handler double-click click private void MDIForm_Load(object sender, EventArgs e) { }

Dr Dat Tran - Week 2 Lecture Notes 6 Add a New Form At design time At run time Double-click on the form to add the Load event handler and modify it as follows Try ShowDialog()

Dr Dat Tran - Week 2 Lecture Notes 7 Owner and Owned Forms If ShowDialog() is used: –Currently active form: Owner form –New form: Owned form Show() does not establish an implicit owner- owned relationship. In the modeless case, establish the relationship as follows: OwnedForm ownedForm = = new OwnedForm(); ownedForm.Owner = this;

Dr Dat Tran - Week 2 Lecture Notes 8 Owner and Owned Forms private Color colour = Color.Yellow;... private void ChangeColorButton_Click(object sender, EventArgs e) { colour = Color.Red; } public Color Colour { get { return colour; }

Dr Dat Tran - Week 2 Lecture Notes 9 Owner and Owned Forms OwnedForm owned; public OwnerForm() { InitializeComponent(); owned = = new OwnedForm(); owned.Owner = this; owned.Show(); panel1.BackColor = owned.Colour; } private void UpdateButton_Click(object sender, EventArgs e) { panel1.BackColor = owned.Colour; }

Dr Dat Tran - Week 2 Lecture Notes 10 Message Box

Dr Dat Tran - Week 2 Lecture Notes 11 Use DialogResult private void MainForm_Load(object sender, EventArgs e) { DialogResult ds = MessageBox.Show("Hello World", "PGUI", DialogResult ds = MessageBox.Show("Hello World", "PGUI", MessageBoxButtons.YesNoCancel); MessageBoxButtons.YesNoCancel); if (ds == DialogResult.Yes) if (ds == DialogResult.Yes) { f2.Text = "Yes"; f2.Text = "Yes"; f2.ShowDialog(); f2.ShowDialog(); } if (ds == DialogResult.No) if (ds == DialogResult.No) { f2.Text = "No"; f2.Text = "No"; f2.ShowDialog(); f2.ShowDialog(); }}

Dr Dat Tran - Week 2 Lecture Notes 12 Visual Inheritance To allow a base class to capture common user interface controls Base form serves as base class Inherited form serves as derived class class InheritedForm : Forms.BaseForm Some issues may arise with regard to event handlers being called twice, because each event is being handled by both the base class and the inherited class

Dr Dat Tran - Week 2 Lecture Notes 13 Multiple-Document Interface (MDI) To display multiple documents at the same time Each document displayed in its own window. MDI applications often have a menu item with submenus for switching between windows or documents The Opacity property does not affect the appearance of MDI child forms. The CenterToParent method does not affect the behavior of MDI child forms

Dr Dat Tran - Week 2 Lecture Notes 14 Create MDI Create a new Windows form Set IsMdiContainer to true (Should set WindowState to Maximized)

Dr Dat Tran - Week 2 Lecture Notes 15 Add Child Forms to MDI public partial class MDIForm : Form { public MDIForm() public MDIForm() { InitializeComponent(); InitializeComponent(); Form mdiChild1 = new Form(); Form mdiChild1 = new Form(); mdiChild1.MdiParent = this; mdiChild1.MdiParent = this; mdiChild1.Show(); mdiChild1.Show(); Form mdiChild2 = new Form(); Form mdiChild2 = new Form(); mdiChild2.MdiParent = this; mdiChild2.MdiParent = this; mdiChild2.Show(); mdiChild2.Show(); } }