Upload
myxro
View
213
Download
0
Embed Size (px)
Citation preview
7/27/2019 2555A_08
1/23
Module 8: Enhancingthe Usability of
Applications
7/27/2019 2555A_08
2/23
Overview
Adding Accessibility Features
Adding Help to an Application
Localizing an Application
7/27/2019 2555A_08
3/23
Lesson: Adding Accessibility Features
7/27/2019 2555A_08
4/23
Accessibility options
Microsoft accessibility aids
Narrator
Magnifier
On-Screen Keyboard
Developers can provide accessibility support by settingproperties on forms and controls in their applications
Accessibility Support in the .NET Framework
7/27/2019 2555A_08
5/23
How to Make Forms and Controls Accessible
this.AppExitButton = new System.Windows.Forms.PushButton();
this.AppExitButton.Text = "E&xit";AppExitButton.AccessibleRole =System.Windows.Forms.AccessibleRole.PushButton;
AppExitButton.AccessibleName = "Exit";AppExitButton.AccessibleDescription = "Use this button to
exit the application";
this.Controls.Add(this.AppExitButton);
Control Property Description
AccessibleName
Briefly describes and identifies
the object. Examples: button
or menu item text
AccessibleDescriptionProvides greater context for
low-vision or blind users
AccessibleRoleDescribes the use of the
element in the user interface
Set standard properties
to values that supportaccessibility
Set accessibility properties
Text, Font Size, Forecolor,Backcolor, BackgroundImage
At design time orprogrammatically
7/27/2019 2555A_08
6/23
How to Test Accessibility
Build the application
Turn on an accessibility aid, such as Narrator
Run the application
7/27/2019 2555A_08
7/23
Practice: Adding Accessibility Support to anApplication
In this practice, you will
Set the AccessibleName property for acontrol
Enable Narrator Run the application to see the results
10 minBegin reviewing the objectives for
this practice activity
7/27/2019 2555A_08
8/23
Lesson: Adding Help to an Application
7/27/2019 2555A_08
9/23
Help in the .NET Framework
Context-sensitive Help
HelpProvidercontrol
HelpButtonproperty
Help menu support
The ToolTip control
7/27/2019 2555A_08
10/23
How to Add Context-Sensitive Help for Forms andControls
Add the HelpProvider controlSet the HelpNamespaceproperty
Add a HelpButton to the form
For each control that you want to add Help information set thefollowing properties
HelpKeyword
HelpNavigator
HelpString
Build and test the application
Give a control focus and press F1
7/27/2019 2555A_08
11/23
How to Link Help Topics to a Menu
Help.ShowHelp (this, HelpProvider.HelpNamespace);
Parent of the Help
dialog box
Path and name of
Help file
Set the HelpNamespace property to point to a file or URL,such as http://localhost/InternalBusinessAppHelp.htm
Add a MainMenu control to the form
AddHelpmenu item and subitems
Implement Helpmenu subitem click event procedures to openthe HelpNamespace
7/27/2019 2555A_08
12/23
Practice: Adding Help to an Application
In this practice, you will
Add context-sensitive Help to anapplication
Link a Help file to context-sensitive Help Link a Help file to a Helpmenu item
15 minBegin reviewing the objectives for
this practice activity
7/27/2019 2555A_08
13/23
How to Display Help with the ToolTip Control
Add the ToolTip control
Build and test theapplication
Set the value for theToolTip on ToolTipproperty
Point to a control that hasan associated ToolTip
7/27/2019 2555A_08
14/23
Practice: Adding ToolTips to an Application
In this practice, you will
Add the ToolTipcontrol to an application
Set the ToolTipproperty for a control
10 minBegin reviewing the objectives for
this practice activity
7/27/2019 2555A_08
15/23
Lesson: Localizing an Application
Globalization
Localization
Culture
Region
7/27/2019 2555A_08
16/23
Localization in the .NET Framework
Localizing the user interface elements
Localizing other resources
Strings
Bitmaps
Other objects, such as audio files
7/27/2019 2555A_08
17/23
How to Set Localization Properties
Create the default culture version of the form
Set the Localizable property of the form to True
Set the appropriate value for the Language propertyof the form
Modify the Text property values for the form and controls intothe appropriate language
Build the application
Resize and/or reposition each control as needed
7/27/2019 2555A_08
18/23
How to Create Localized Resource Files
Open an existing project and add an assembly resource filefor the appropriate culture
Add entries to the resource file with values in the appropriatelanguage for the culture
Save the file
Build the application
7/27/2019 2555A_08
19/23
How to Change the Locale
using System.Globalization;using System.Resources;using System.Threading;
Thread.CurrentThread.CurrentUICulture =
Thread.CurrentThread.CurrentCulture;
ResourceManager rm = newResourceManager("MyNamespace.Resource1",Assembly.GetExecutingAssembly());
MessageBox.Show(rm.GetString("test_1"));
Root name of theresource file
Main assembly forthe resources
Add code to an application to programmatically set theculture and UICulture for an application to the new value
Add code to the application to use a resource manager to
extract the elements from the resource file
The user can change the regional and languageoptions from Control Panel
7/27/2019 2555A_08
20/23
Practice: Localizing an Application
In this practice, you will
Localize the user interface of anapplication
Add localized string resources to anapplication
15 minBegin reviewing the objectives for
this practice activity
7/27/2019 2555A_08
21/23
Review
Adding Accessibility Features
Adding Help to an Application
Localizing an Application
7/27/2019 2555A_08
22/23
Lab 8.1: Enhancing the Usability of an Application
Exercise 1: Adding Support for Accessibility
Exercise 2: Adding Help to an Application
Exercise 3: Adding ToolTips to an Application
Exercise 4: Localizing the User Interface of anApplication
Exercise 5: Localizing Resources in anApplication
7/27/2019 2555A_08
23/23
Course Evaluation