Some Interesting Controls. Controls We've UsedNew Controls LabelListBox TextBoxCheckedListBox ComboBoxTabControl ButtonTabPage Menu MenuItem TreeView.

Slides:



Advertisements
Similar presentations
Interaction Design: Visio
Advertisements

Pemrograman VisualMinggu …8… Page 1 MINGGU Ke Delapan Pemrograman Visual Pokok Bahasan: Graphical User Interface Tujuan Instruksional Khusus: Mahasiswa.
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
© by Pearson Education, Inc. All Rights Reserved. continued …
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Common Windows Controls. Objectives Learn about common Windows controls Load, display, and share images with other control instances using the ImageList.
C# Programming: From Problem Analysis to Program Design1 Programming Based on Events C# Programming: From Problem Analysis to Program Design 3 rd Edition.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
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.
Group Boxes and Panels Arrange components on a GUI Buttons and etc. can be placed inside a group box or panel. All these buttons move together when the.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 13: Advanced GUI and Graphics
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Module 3 Productivity Programs Common Features and Commands Microsoft Office 2007.
BİL528 – Bilgisayar Programlama II Advanced Controls, Menus, Toolbars, and Status Bars 1.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
BIM313 – Advanced Programming Simple Controls 1. Contents Traditional Controls – Labels, Text Boxes, Buttons, Check Boxes, List Boxes, Combo Boxes Advanced.
IE 411/511: Visual Programming for Industrial Applications
1 Web-Enabled Decision Support Systems Windows Forms and Controls Prof. Name Position (123) University Name.
Chapter 12: Using Controls. Examining the IDE’s Automatically Generated Code A new Windows Forms project has been started and given the name FormWithALabelAndAButton.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 – Graphical User Interfaces Part 2 Outline.
Graphical User Interface Concepts - Part 2 Session 09 Mata kuliah: M0874 – Programming II Tahun: 2010.
1. Chapter 4 Customizing Paragraphs 3 More Paragraph Changes Highlight a paragraph in Word by applying borders and shading. Sort paragraphs to control.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 - Graphical User Interface Concepts: Part.
Key Applications Module Lesson 21 — Access Essentials
Graphical User Interfaces 2 Tonga Institute of Higher Education.
Exploring Windows and Essential Computing Concepts 1 Windows Desktop u Windows Basics u Icon u Start Button u My Computer u Network Neighborhood u Recycle.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Microsoft Office XP Illustrated Introductory, Enhanced Started with Windows 2000 Getting.
1 Chapter Ten Using Controls. 2 Objectives Learn about Controls How to create a Form containing Labels How to set a Label’s Font How to add Color to a.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
More Controls and Their Properties Part 4 dbg --- TextBox, CheckBox, RadioButton, GroupBox, ToolTips,
Copyright © Curt Hill More Components Varying the input of Dev-C++ Windows Programs.
Win32 Controls & ActiveX Integration In this presentation… –Introduction to the new Win32 controls. What they are? How they are enabled? Potential uses.
User Interface Components Lecture # 5 From: interface-elements.html.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Object-Oriented Application Development Using VB.NET 1 Chapter 10 VB.NET GUI Components Overview.
Menus Menus provide groups of related commands for windows applications Menu, menu items, submenus A menu item that contains a submenu is considered to.
Swing - 2 Session 13. Swing - 2 / 2 of 38 Objectives (1) Discuss trees and tables Discuss progress bars Discuss MVC architecture Describe menus.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Compunet Corporation Programming with Visual Basic.NET Working with Menus and Dialog Boxes Week 14 Tariq Aziz and Kevin Jones.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Graphical User Interfaces Part 2 1 Outline TreeViews ListViews Tab Control.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
 You won’t write a single line of program code.  Instead, you’ll use visual programming techniques.  Visual Studio processes your actions (such as mouse.
Graphical User Interface Concepts - Part 1 Session 08 Mata kuliah: M0874 – Programming II Tahun: 2010.
Dive Into® Visual Basic 2010 Express
Graphical User Interface
Chapter 1: An Introduction to Visual Basic 2015
Chapter 2 – Introduction to the Visual Studio .NET IDE
Chapter 22 Tree View and List View
Chapter 2 – Introduction to the Visual Studio .NET IDE
DREAMWEAVER MX 2004 Chapter 3 Working with Tables
Visual Studio.
Visual C# - GUI and controls - 1
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Chapter 4 Enhancing the Graphical User Interface
Presentation transcript:

Some Interesting Controls

Controls We've UsedNew Controls LabelListBox TextBoxCheckedListBox ComboBoxTabControl ButtonTabPage Menu MenuItem TreeView TreeNode PictureBox

ListBoxes and CheckedListBoxes ListBox –View and select from multiple items –Scroll bar appears if necessary CheckedListBox –Items have checkbox –Select multiple items at same time –Scroll bar appears if necessary

ListBoxes and CheckedListBoxes

ListBoxes ListBox properties, methods and events

ListBoxes

CheckedListBoxes CheckedListBox properties, methods and events.

CheckedListBox

ListBox

ListBox Control Public Class ListBox Inherits ListControl The ListBox control enables you to display a list of items to the user that the user can select by clicking. A ListBox control can provide single or multiple selections using the SelectionMode property. The ListBox also provides the MultiColumn property to enable the display of items in columns instead of a straight vertical list of items. This allows the control to display more visible items and prevents the need for the user to scroll to an item. In addition to display and selection functionality, the ListBox also provides features that enable you to efficiently add items to the ListBox and to find text within the items of the list.

ListBox Control (continued) Public Class ListBox Inherits ListControl The BeginUpdate and EndUpdate methods enable you to add a large number of items to the ListBox without the control being repainted each time an item is added to the list. The FindString and FindStringExact methods enable you to search for an item in the list that contains a specific search string. The Items, SelectedItems, and SelectedIndices properties provide access to the three collections that are used by the ListBox.

CheckedListBox Control

Public Class CheckedListBox Inherits ListBox This control presents a list of items that the user can navigate by using the keyboard or the scrollbar on the right side of the control. The user can place a check mark by one or more items and the checked items can be navigated with the CheckedListBox.CheckedItemCollection and CheckedListBox.CheckedIndexCollection. To add objects to the list at run time, assign an array of object references with the AddRange method. The list then displays the default string value for each object. You can add individual items to the list with the Add method. The CheckedListBox object supports three states through the CheckState enumeration: Checked, Indeterminate, and Unchecked. You must set the state of Indeterminate in the code because the user interface for a CheckedListBox does not provide a mechanism to do so. If UseTabStops is true, the CheckedListBox will recognize and expand tab characters in an item's text, creating columns. However, the tab stops are present and cannot be changed.

The CheckedListBox class supports the following three indexed collections All items contained in the CheckedListBox control. –CheckedListBox.ObjectCollection Checked items (including items in an indeterminate state), which is a subset of the items contained in the CheckedListBox control. –CheckedListBox.CheckedItemCollection Checked indexes, which is a subset of the indexes into the items collection. These indexes specify items in a checked or indeterminate state. –CheckedListBox.CheckedIndexCollection

Tab Control –Creates tabbed windows –Saves space using TabPage objects TabPage objects –Similar to Panels and GroupBoxes –Can contain controls

Tab Control

TabControl properties and events.

Tab Control

Public Class TabControl Inherits Control A TabControl contains tab pages, which are represented by TabPage objects that you add through the Controls property. Note The following events are not raised for the TabControl class unless there is at least one TabPage in the TabControl.TabPages collection: Control.Click, Control.DoubleClick, Control.MouseDown, Control.MouseUp, Control.MouseHover, Control.MouseEnter, Control.MouseLeave and Control.MouseMove. If there is at least one TabPage in the collection, and the user interacts with the tab control’s header (where the TabPage names appear), the TabControl raises the appropriate event. However, if the user interaction is within the ClientRectangle of the tab page, the TabPage raises the appropriate event.

TabPage Control

Public Class TabPage Inherits Panel Represents a single tab page in a TabControl. For more information about how this control responds to the Focus and Select methods, see the following Control members: CanFocus, CanSelect, Focused, ContainsFocus, Focus, Select.

Menus Menu –Groups related commands –Organize without “cluttering” GUI Menu items –Commands or options in menu Sub-menu –Menu within a menu Hot keys –Alt key shortcuts Press Alt + underlined letter in desired menu item

Menus

MainMenu and MenuItem properties and events.

MainMenu Class

Public Class MainMenu Inherits Menu Represents the menu structure of a form. The MainMenu control represents the container for the menu structure of a form. A menu is composed of MenuItem objects that represent the individual menu commands in the menu structure. Each MenuItem can be a command for your application or a parent menu for other submenu items. To bind the MainMenu to the Form that will display it, assign the MainMenu to the Menu property of the Form.

MainMenu Class (continued) You can create different MainMenu objects to represent different menu strutures for your form. If you want to reuse the menu structure contained in a specific MainMenu, you can use its CloneMenu method to create a copy. Once you have a copy of the menu structure, you can make the appropriate modifications for your new menu structure.

MenuItem Control

Public Class MenuItem Inherits Menu Represents an individual item that is displayed within a MainMenu or ContextMenu. In order for a MenuItem to be displayed, you must add it to a MainMenu or ContextMenu. To create submenus, you can add MenuItem objects to the MenuItems property of the parent MenuItem. The MenuItem class provides properties that enable you to configure the appearance and functionality of a menu item. –To display a check mark next to a menu item, use the Checked property. You can use this feature to identify a menu item that is selected in a list of mutually exclusive menu items. For example, if you have a set of menu items for setting the color of text in a TextBox control, you can use the Checked property to identify which color is currently selected. –The Shortcut property can be used to define a keyboard combination that can be pressed to select the menu item.

MenuItem Control (Continued) For MenuItem objects displayed in a Multiple Document Interface (MDI) application, you can use the MergeMenu method to merge the menus of an MDI parent for with that of its child forms to create a consolidated menu structure. Because a MenuItem cannot be reused in multiple locations at the same time, such as in a MainMenu and a ContextMenu, you can use the CloneMenu method to create a copy of a MenuItem for use in another location. The Popup event enables you to perform tasks before a menu is displayed. For example, you can create an event handler for this event to display or hide menu items based on the state of your code. The Select event enables you to perform tasks such as providing detailed help for your application's menu items when the user places the mouse cursor over a menu item.

TreeView TreeView Control –Displays nodes hierarchically –Nodes Objects that contain values –Parent node »Contains child nodes »Can be expanded or collapsed –Root node »First parent node of a tree –Sibling nodes »Have same parent node –Child nodes »Can have child nodes of their own

TreeView

TreeView properties and events.

TreeView TreeNode properties and methods.

TreeView

TreeView Control

Public Class TreeView Inherits Control Displays a hierarchical collection of labeled items, each represented by a TreeNode. The Nodes collection holds all the TreeNode objects that are assigned to the TreeView control. The tree nodes in this collection are referred to as the root tree nodes. Any tree node that is subsequently added to a root tree node is referred to as a child node. Because each TreeNode can contain a collection of other TreeNode objects, you might find it difficult to determine your location in the tree structure when you iterate through the collection. You can parse the TreeNode.FullPath string by using the PathSeparator string value to determine where a TreeNode label begins and ends.

TreeView Control (continued) You can display images next to the tree nodes by assigning an ImageList object to the ImageList property, and referencing the index value of an Image in the ImageList to assign that Image. Set the ImageIndex property to the index value of the Image that you want to display when a tree node is not selected. Likewise, set the SelectedImageIndex property to the index value of the Image that you want to display when a tree node is selected. The images referenced by the ImageIndex and SelectedImageIndex property values are the default images displayed by all the tree nodes that are assigned to the Nodes collection. Each tree node can override the default images by setting the TreeNode.ImageIndex and TreeNode.SelectedImageIndex properties.

TreeView Control (continued) Tree nodes can be expanded to display the next level of child tree nodes. The user can expand the TreeNode by clicking the plus-sign (+) button, if one is displayed next to the TreeNode, or you can expand the TreeNode by calling the TreeNode.Expand method. To expand all the child tree node levels in the Nodes collection, call the ExpandAll method. You can collapse the child TreeNode level by calling the TreeNode.Collapse method, or the user can press the minus- sign (-) button, if one is displayed next to the TreeNode. You can also call the TreeNode.Toggle method to alternate between the expanded and collapsed states.

TreeView Control (continued) Tree nodes can optionally display check boxes. To display the check boxes, set the CheckBoxes property of the TreeView to true. The Checked property is set to true for tree nodes that are in a checked state. Note Setting the TreeNode.Checked property from within the BeforeCheck or AfterCheck event causes the event to be raised multiple times and can result in unexpected behavior. For example, you might set the Checked property in the event handler when you are recursively updating the child nodes, so the user does not have to expand and check each one individually.

TreeView Control (continued) To prevent the event from being raised multiple times, add logic to your event handler that only executes your recursive code if the Action property of the TreeViewEventArgs is not set to TreeViewAction.Unknown. For an example of how to do this, see the Example section of the AfterCheck or BeforeCheck events. You can change the appearance of the TreeView control by setting some of its display and style properties. Setting ShowPlusMinus to true displays a plus-sign or minus- sign button next to each TreeNode object that can be expanded or collapsed, respectively. Setting the ShowRootLines property to true causes the TreeView to display lines that join all the root tree nodes together. You can display lines that connect child tree nodes to their root node by setting the ShowLines property to true.

TreeView Control (continued) Setting the HotTracking property to true changes the appearance of the tree node labels as the mouse pointer passes over them. When hot-tracked, the tree node labels take on the appearance of a hyperlink. Note When setting the CheckBoxes, Scrollable, ImageIndex, and SelectedImageIndex properties at run time, the TreeView handle is recreated (see Control.RecreateHandle) to update the control's appearance. This causes all tree nodes to be collapsed, with the exception of the selected TreeNode.

TreeNode Class

Public Class TreeNode Inherits MarshalByRefObject Implements ICloneable, ISerializable The Nodes collection holds all the child TreeNode objects assigned to the current TreeNode. You can add, remove, or clone a TreeNode; when doing so, all child tree nodes are added, removed, or cloned. Each TreeNode can contain a collection of other TreeNode objects. This can make it difficult to determine where you are in the TreeView when iterating through the collection. To determine your location in a tree structure, use the FullPath property. The FullPath string can be parsed using the PathSeparator string value to determine where a TreeNode label begins and ends.

TreeNode Class The TreeNode label is set by setting the Text property explicitly. The alternative is to create the tree node using one of the TreeNode constructors that has a string parameter that represents the Text property. The label is displayed next to the TreeNode image, if one is displayed. To display images next to the tree nodes, assign an ImageList to the ImageList property of the parent TreeView control and assign an Image by referencing its index value in the ImageList property. Set the ImageIndex property to the index value of the Image you want to display when the TreeNode is in an unselected state. Likewise, set the SelectedImageIndex property to the index value of the Image you want to display when the TreeNode is selected.

TreeNode Class Selecting specific tree nodes and iterating through the Nodes collection can be achieved by using the following property values: FirstNode, LastNode, NextNode, PrevNode, NextVisibleNode, PrevVisibleNode. Assign the TreeNode object returned by one of aforementioned properties to the TreeView.SelectedNode property to select that tree node in the TreeView control. Tree nodes can be expanded to display the next level of child tree nodes. The user can expand the TreeNode by pressing the plus (+) button next to the TreeNode, if one is displayed, or you can expand the TreeNode by calling the Expand method. To expand all child tree node levels in the Nodes collection, call the ExpandAll method.

TreeNode Class You can collapse the child TreeNode level by calling the Collapse method, or the user can press the minus (-) button next to the TreeNode, if one is displayed. You can also call the Toggle method to alternate the TreeNode between the expanded and collapsed states. Tree nodes can optionally display a check box. To display the check boxes, set the CheckBoxes property of the TreeView to true. The Checked property is set to true for tree nodes that are in a checked state.

Control Tester Homework Assignment

PictureBoxes –Display images Bitmap GIF (Graphics Interchange Format) JPEG (Joint Photographic Expert Group) Metafile –Image property Image to be displayed

PictureBoxes PictureBox properties and events.

PictureBox Class

Public Class PictureBox Inherits Control Typically the PictureBox is used to display graphics from a bitmap, metafile, icon, JPEG, GIF or PNG file. Set the Image property to the Image you want to display, either at design time or at run time. Clipping and positioning of the image in the display area is controlled by the SizeMode property which is set to values in the PictureBoxSizeMode enumeration. You can change the size of the display area at run time with the ClientSize property. The PictureBox control is displayed by default without any borders. You can provide a standard or three-dimensional border using the BorderStyle property to distinguish the picture box from the rest of the form, even if it contains no image.

Control Tester Homework Assignment