St. Ambrose CSCI 275 - More Controls

Unformatted text preview:

Chapter 2 More ControlsControls in the ToolboxButton (btn)Text Box (txt)Group Box (grp)Check Box (chk)Radio Button (rad)Picture Box (pic)Borders and StylesDrawing a LineSelecting Multiple ControlsSelecting Multiple Controls (cont.)What Can be Done with Multiple Selected Controls?Designing the User InterfaceKeyboard Access KeysDefault & Cancel ButtonsFocusTab OrderSetting TabIndex PropertyForm's Screen LocationToolTipsToolTip ControlClearing Text Boxes & LabelsResetting the FocusChecked Property of Check Boxes and Radio ButtonsVB Color ConstantsWith and End WithConcatenationContinuing Lines of CodeChapter 2More ControlsProgramming InVisual Basic.NET© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 2Controls in the Toolbox© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 3Button (btn)•Used to run/activate an Event Procedure•Click eventLabel (lbl)•Used for–Output on a form–Identification of objects–Directions/Information•Cannot by modified by user© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 4Text Box (txt)•Used for user input/data entry•Text Property–What is displayed in text box–What user entered in text box•TextAlign Property–Controls alignment of text in the Text Box•Change Event© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 5Group Box (grp)•Used as containers for other controls such as radio buttons and check boxes•Improves readability of form•Text Property–What is displayed on the top edge of the group box© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 6Check Box (chk)•Used for user input/data entry•Allows the user to select or deselect 1 or more in any group•Checked Property - Boolean–Checked = True–Unchecked = False•CheckChanged Event© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 7Radio Button (rad)•Used for user input/data entry•Allows the user to select only 1 in any group•First create a group and then create each radio button inside the group•Checked Property - Boolean–Checked = True–Unchecked = False•CheckChanged Event© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 8Picture Box (pic)•Displays/contains a picture/graphic•Image Property–Complete path and filename of graphic–.bmp, .gif (including animated), .jpg, .png, .ico, .emf, .wmf•SizeMode Property–StretchImage causes graphic to be resized to match the size of the control•Visible Property© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 9Borders and Styles•BorderStyle Property–None–FixedSingle–Fixed3D© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 10Drawing a Line•Use Label Control–Text=blank–BorderStyle=None–BackColor=desired line color–Width and Height as desired•Use the Graphics Methods covered in Chapter 12© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 11Selecting Multiple Controls•SHIFT-Click or CTRL-Click to select/deselect multiple controls•Use the mouse to drag a selection box around multiple controls•To deselect all selected controls click elsewhere on the form© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 12Selecting Multiple Controls (cont.)Multiple selected controls,observe selection handles.Using mouse to drag a selection box around multiple controlsStarthereDragto here© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 13What Can be Done with Multiple Selected Controls?•Use Format Menu or Layout Toolbar to –Align them to each other–Make same size–Modify the spacing between them•Move them as a group•Set their common properties© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 14Designing the User Interface•To the user the Interface should be–Easy to understand–Familiar–Comfortable–Organized–Sans Serif Fonts are best, not boldface or large–Color Neutral Overall–Keyboard Accessible© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 15Keyboard Access Keys•Also referred to as Hot Keys•Underlined Letter•User presses ALT + underlined letter•Use Windows-Standard Keys•Defined using Text PropertyText=&OKText=E&xit© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 16Default & Cancel Buttons•Default Button–Identified visually on Form by its darker outline–Responds to ENTER key–Form's AcceptButton Property•Cancel Button–Responds to ESC key–Form's CancelButton Property© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 17Focus•One control on a Form always has the Focus•Not all control types can receive the focus•TabStop Property (applicable only for controls that are capable of receiving the focus)–Designates whether a control is allowed to receive the focus; True or False© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 18Tab Order•User should be able to use TAB key to move the focus through a form in an organized manner; top to bottom, left to right•TabIndex Property–Number in tab sequence–0 for first control to receive the focus when the form loads•Use View Menu, Tab Order to set© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 19Setting TabIndex Property•View menu, TabOrder•Click on each control in sequence to set TabIndex property of controls automatically© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 20Form's Screen Location•StartPosition Property–Manual–CenterScreen–WindowsDefaultLocation–WindowsDefaultBounds–CenterParent© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 21ToolTips•Small label that is displayed when user places pointer on a control and pauses•Usually used with Command Buttons•Steps for creating ToolTips–Add a ToolTip Control to Form•Appears in the Component Tray, pane at bottom of Form Designer where nondisplay controls are shown–Set ToolTip on ToolTip1 Property of each control to the text of tip© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 22ToolTip ControlComponent Tray© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2- 23txtName.Text = ""lblMessage.Text = ""txtCourse.Clear( ) Clearing Text Boxes & Labels•Set Text Property equal to the Empty String–Empty String is 2 quotation marks with no space between them ("")•Use the Clear Method of a Text Box© 2001 by The McGraw-Hill Companies, Inc. All rights reserved.2-


View Full Document

St. Ambrose CSCI 275 - More Controls

Download More Controls
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view More Controls and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view More Controls 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?