SlideShare a Scribd company logo
1 of 27
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 1
Chapter 24
How to enhance
the user interface
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 2
Objectives
Applied
1. Use the Tab control to organize an application.
2. Use a multiple-document interface for an application.
3. Add menus, toolbars, and help information to an application.
Knowledge
1. Distinguish between a single-document and a multiple-
document interface.
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 3
Single-document interface (SDI)
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 4
Multiple-document interface (MDI)
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 5
A startup form for the Financial Calculations
application
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 6
Code that displays a new instance of a form
private void btnFutureValue_Click(object sender,
System.EventArgs e)
{
Form newForm = new frmFutureValue();
newForm.Show();
}
Code that exits the application and closes all
forms
private void btnExit_Click(object sender,
System.EventArgs e)
{
Application.Exit();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 7
Code that closes the current instance of a form
private void btnClose_Click(object sender,
System.EventArgs e)
{
this.Close();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 8
A form that uses a Tab control with two tabs
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 9
Code that uses the SelectedIndex property of the
Tab control
private void btnCalculate_Click(object sender,
System.EventArgs e)
{
if (tabCalculations.SelectedIndex == 0)
DisplayFutureValue();
else if (tabCalculations.SelectedIndex == 1)
DisplayDepreciation();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 10
Code that uses the SelectedIndexChanged event
of the Tab control
private void tabCalculations_SelectedIndexChanged(
object sender, System.EventArgs e)
{
if (tabCalculations.SelectedIndex == 0)
txtMonthlyInvestment.Focus();
else if (tabCalculations.SelectedIndex == 1)
txtInitialCost.Focus();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 11
The start of the menu for the Future Value app
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 12
The complete Action menu
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 13
Common menu item properties
• Text
• Name
• Checked
• Enabled
• Visible
• ShortcutKeys
• ShowShortcutKeys
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 14
Code for a menu item that clears four controls
private void mnuClear_Click(object sender,
System.EventArgs e)
{
txtMonthlyInvestment.Text = "";
txtInterestRate.Text = "";
txtYears.Text = "";
txtFutureValue.Text = "";
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 15
Code for a menu item that calls another event
handler
private void mnuCalculate_Click(object sender,
System.EventArgs e)
{
btnCalculate_Click(sender, e);
}
Another way to call another event handler
private void mnuCalculate_Click(object sender,
System.EventArgs e)
{
btnCalculate.PerformClick();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 16
A project with one parent and two child forms
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 17
Properties and methods for a parent form
Property/Method Description
IsMdiContainer At design-time, set this property to true.
ActiveMdiChild At runtime, you can use this property to
retrieve a reference to the active child form.
LayoutMdi(mdiLayout) At runtime, you can use this method to
arrange all child forms by specifying a
member of the MdiLayout enumeration:
Cascade, TileVertical, TileHorizontal, and
so on.
Typical property setting for a child form
Property Description
MdiParent At runtime, you can set this property to specify the
parent form for a child form.
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 18
An MDI application with three child forms
arranged vertically
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 19
Code that creates and displays a new instance of
a child form
private void mnuNewFutureValue_Click(object sender,
System.EventArgs e)
{
Form newForm = new frmFutureValue();
newForm.MdiParent = this;
newForm.Show();
}
Code that refers to the active child form
private void mnuClose_Click(object sender,
System.EventArgs e)
{
Form activeForm = this.ActiveMdiChild;
if (activeForm != null)
activeForm.Close();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 20
Code that arranges the child forms vertically
private void mnuTileVertical_Click(object sender,
System.EventArgs e)
{
this.LayoutMdi(MdiLayout.TileVertical);
}
Code that exits the application and closes all child
forms
private void mnuExit_Click(object sender,
System.EventArgs e)
{
Application.Exit();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 21
A ToolStrip with the standard items
A ToolStrip with two custom buttons
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 22
The Items Collection Editor for a ToolStrip
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 23
Code for the Click event of a button on a ToolStrip
private void btnFutureValue_Click(object sender,
EventArgs e)
{
mnuNewFutureValue.PerformClick();
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 24
A View menu that shows or hides the toolbar
Code that shows or hides a toolbar depending on
a menu selection
private void mnuToolbar_Click(object sender,
System.EventArgs e)
{
if (mnuToolbar.Checked == true)
{
mnuToolbar.Checked = false;
tlbMain.Visible = false;
}
else if (mnuToolbar.Checked == false)
{
mnuToolbar.Checked = true;
tlbMain.Visible = true;
}
}
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 25
A tool tip Context-sensitive help
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 26
How to work with a tool tip
• A tool tip is a brief description of a control that’s displayed
automatically when you place the mouse pointer over that control.
• To create tool tips for a form, add a ToolTip control to the form.
A control named toolTip1 will appear in the Component Designer
tray at the bottom of the window.
• The ToolTip control makes a property named “ToolTip on
toolTip1” available for each control on the form and for the form
itself. You can enter the text for the tool tip in this property.
Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 27
How to work with context-sensitive help
• To provide context-sensitive help for a form or control, add a
HelpProvider control to the form. A control named helpProvider1
will appear in the Component Designer tray at the bottom of the
window. This control makes several additional properties
available for the form and each control it contains.
• To display a text string when the user presses the F1 key for the
control that has the focus, enter the text for the “HelpString on
helpProvider1” property of the control.
• You can also enter help text for the HelpString property of the
form. Then, that text is displayed at the location of the mouse
pointer if a help string isn’t specified for the control that has the
focus.
• When you enter text for the “HelpString on helpProvider1”
property, the “ShowHelp on helpProvider1” property
automatically changes from false to true.

More Related Content

What's hot

C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slidesC# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slidesC# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-15-slidesC# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-15-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-11-slidesC# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-11-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slidesC# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slidesC# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesC# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slidesC# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-16-slidesC# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-16-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slidesC# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slidesC# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesC# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slidesC# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slidesSami Mut
 
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesC# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesSami Mut
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Designfrancopw
 

What's hot (20)

C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slidesC# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
 
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slidesC# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slides
 
C# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-15-slidesC# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-15-slides
 
C# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-11-slidesC# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-11-slides
 
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slidesC# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slides
 
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slidesC# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slides
 
C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesC# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slides
 
C# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slidesC# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slides
 
C# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-16-slidesC# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-16-slides
 
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slidesC# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slides
 
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slidesC# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
 
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesC# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
 
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slidesC# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
 
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesC# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slides
 
Intake 38 8
Intake 38 8Intake 38 8
Intake 38 8
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Intake 37 9
Intake 37 9Intake 37 9
Intake 37 9
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 

Similar to C# Tutorial MSM_Murach chapter-24-slides

Vb net xp_09
Vb net xp_09Vb net xp_09
Vb net xp_09Niit Care
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03PCC
 
COIT20270 Application Development for Mobile PlatformsWeek 4.docx
COIT20270 Application Development for Mobile PlatformsWeek 4.docxCOIT20270 Application Development for Mobile PlatformsWeek 4.docx
COIT20270 Application Development for Mobile PlatformsWeek 4.docxmary772
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
How to Validate Form With Flutter BLoC.pptx
How to Validate Form With Flutter BLoC.pptxHow to Validate Form With Flutter BLoC.pptx
How to Validate Form With Flutter BLoC.pptxBOSC Tech Labs
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAhsanul Karim
 
1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdf
1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdf1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdf
1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdfkannanelectronite
 
Vb net xp_12
Vb net xp_12Vb net xp_12
Vb net xp_12Niit Care
 
Refinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunRefinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunEngr. Adefami Segun, MNSE
 
Required is a project that seeks to develop a program that check.pdf
Required is a project that seeks to develop a program that check.pdfRequired is a project that seeks to develop a program that check.pdf
Required is a project that seeks to develop a program that check.pdfclimatecontrolsv
 
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docxMicrosoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docxkeshayoon3mu
 

Similar to C# Tutorial MSM_Murach chapter-24-slides (17)

Vb net xp_09
Vb net xp_09Vb net xp_09
Vb net xp_09
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03
 
COIT20270 Application Development for Mobile PlatformsWeek 4.docx
COIT20270 Application Development for Mobile PlatformsWeek 4.docxCOIT20270 Application Development for Mobile PlatformsWeek 4.docx
COIT20270 Application Development for Mobile PlatformsWeek 4.docx
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
How to Validate Form With Flutter BLoC.pptx
How to Validate Form With Flutter BLoC.pptxHow to Validate Form With Flutter BLoC.pptx
How to Validate Form With Flutter BLoC.pptx
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
 
1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdf
1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdf1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdf
1.1 Project 2 Palindrome Mini-Project [55] Required is a project t.pdf
 
Vb net xp_12
Vb net xp_12Vb net xp_12
Vb net xp_12
 
4.C#
4.C#4.C#
4.C#
 
Refinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunRefinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami Olusegun
 
Required is a project that seeks to develop a program that check.pdf
Required is a project that seeks to develop a program that check.pdfRequired is a project that seeks to develop a program that check.pdf
Required is a project that seeks to develop a program that check.pdf
 
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docxMicrosoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
 
Android UI
Android UIAndroid UI
Android UI
 
Flutter and Dart MCQS
Flutter and Dart MCQSFlutter and Dart MCQS
Flutter and Dart MCQS
 

More from Sami Mut

chapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodiachapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodiaSami Mut
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiaSami Mut
 
chapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodiachapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodiaSami Mut
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiaSami Mut
 
chapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodiachapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodiaSami Mut
 

More from Sami Mut (6)

MSM_Time
MSM_TimeMSM_Time
MSM_Time
 
chapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodiachapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodia
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
 
chapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodiachapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodia
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
 
chapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodiachapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodia
 

Recently uploaded

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 

Recently uploaded (20)

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 

C# Tutorial MSM_Murach chapter-24-slides

  • 1. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 1 Chapter 24 How to enhance the user interface
  • 2. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 2 Objectives Applied 1. Use the Tab control to organize an application. 2. Use a multiple-document interface for an application. 3. Add menus, toolbars, and help information to an application. Knowledge 1. Distinguish between a single-document and a multiple- document interface.
  • 3. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 3 Single-document interface (SDI)
  • 4. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 4 Multiple-document interface (MDI)
  • 5. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 5 A startup form for the Financial Calculations application
  • 6. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 6 Code that displays a new instance of a form private void btnFutureValue_Click(object sender, System.EventArgs e) { Form newForm = new frmFutureValue(); newForm.Show(); } Code that exits the application and closes all forms private void btnExit_Click(object sender, System.EventArgs e) { Application.Exit(); }
  • 7. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 7 Code that closes the current instance of a form private void btnClose_Click(object sender, System.EventArgs e) { this.Close(); }
  • 8. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 8 A form that uses a Tab control with two tabs
  • 9. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 9 Code that uses the SelectedIndex property of the Tab control private void btnCalculate_Click(object sender, System.EventArgs e) { if (tabCalculations.SelectedIndex == 0) DisplayFutureValue(); else if (tabCalculations.SelectedIndex == 1) DisplayDepreciation(); }
  • 10. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 10 Code that uses the SelectedIndexChanged event of the Tab control private void tabCalculations_SelectedIndexChanged( object sender, System.EventArgs e) { if (tabCalculations.SelectedIndex == 0) txtMonthlyInvestment.Focus(); else if (tabCalculations.SelectedIndex == 1) txtInitialCost.Focus(); }
  • 11. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 11 The start of the menu for the Future Value app
  • 12. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 12 The complete Action menu
  • 13. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 13 Common menu item properties • Text • Name • Checked • Enabled • Visible • ShortcutKeys • ShowShortcutKeys
  • 14. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 14 Code for a menu item that clears four controls private void mnuClear_Click(object sender, System.EventArgs e) { txtMonthlyInvestment.Text = ""; txtInterestRate.Text = ""; txtYears.Text = ""; txtFutureValue.Text = ""; }
  • 15. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 15 Code for a menu item that calls another event handler private void mnuCalculate_Click(object sender, System.EventArgs e) { btnCalculate_Click(sender, e); } Another way to call another event handler private void mnuCalculate_Click(object sender, System.EventArgs e) { btnCalculate.PerformClick(); }
  • 16. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 16 A project with one parent and two child forms
  • 17. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 17 Properties and methods for a parent form Property/Method Description IsMdiContainer At design-time, set this property to true. ActiveMdiChild At runtime, you can use this property to retrieve a reference to the active child form. LayoutMdi(mdiLayout) At runtime, you can use this method to arrange all child forms by specifying a member of the MdiLayout enumeration: Cascade, TileVertical, TileHorizontal, and so on. Typical property setting for a child form Property Description MdiParent At runtime, you can set this property to specify the parent form for a child form.
  • 18. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 18 An MDI application with three child forms arranged vertically
  • 19. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 19 Code that creates and displays a new instance of a child form private void mnuNewFutureValue_Click(object sender, System.EventArgs e) { Form newForm = new frmFutureValue(); newForm.MdiParent = this; newForm.Show(); } Code that refers to the active child form private void mnuClose_Click(object sender, System.EventArgs e) { Form activeForm = this.ActiveMdiChild; if (activeForm != null) activeForm.Close(); }
  • 20. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 20 Code that arranges the child forms vertically private void mnuTileVertical_Click(object sender, System.EventArgs e) { this.LayoutMdi(MdiLayout.TileVertical); } Code that exits the application and closes all child forms private void mnuExit_Click(object sender, System.EventArgs e) { Application.Exit(); }
  • 21. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 21 A ToolStrip with the standard items A ToolStrip with two custom buttons
  • 22. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 22 The Items Collection Editor for a ToolStrip
  • 23. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 23 Code for the Click event of a button on a ToolStrip private void btnFutureValue_Click(object sender, EventArgs e) { mnuNewFutureValue.PerformClick(); }
  • 24. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 24 A View menu that shows or hides the toolbar Code that shows or hides a toolbar depending on a menu selection private void mnuToolbar_Click(object sender, System.EventArgs e) { if (mnuToolbar.Checked == true) { mnuToolbar.Checked = false; tlbMain.Visible = false; } else if (mnuToolbar.Checked == false) { mnuToolbar.Checked = true; tlbMain.Visible = true; } }
  • 25. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 25 A tool tip Context-sensitive help
  • 26. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 26 How to work with a tool tip • A tool tip is a brief description of a control that’s displayed automatically when you place the mouse pointer over that control. • To create tool tips for a form, add a ToolTip control to the form. A control named toolTip1 will appear in the Component Designer tray at the bottom of the window. • The ToolTip control makes a property named “ToolTip on toolTip1” available for each control on the form and for the form itself. You can enter the text for the tool tip in this property.
  • 27. Murach’s C# 2010, C24 © 2010, Mike Murach & Associates, Inc. Slide 27 How to work with context-sensitive help • To provide context-sensitive help for a form or control, add a HelpProvider control to the form. A control named helpProvider1 will appear in the Component Designer tray at the bottom of the window. This control makes several additional properties available for the form and each control it contains. • To display a text string when the user presses the F1 key for the control that has the focus, enter the text for the “HelpString on helpProvider1” property of the control. • You can also enter help text for the HelpString property of the form. Then, that text is displayed at the location of the mouse pointer if a help string isn’t specified for the control that has the focus. • When you enter text for the “HelpString on helpProvider1” property, the “ShowHelp on helpProvider1” property automatically changes from false to true.