Chapter 22 Tree View and List View

Slides:



Advertisements
Similar presentations
© 2011 Delmar, Cengage Learning Chapter 1 Getting Started with Dreamweaver.
Advertisements

Start menu -> all program -> Microsoft Visual SourceSafe-> Microsoft Visual Studio 2010 Click.
© by Pearson Education, Inc. All Rights Reserved.
Common Windows Controls. Objectives Learn about common Windows controls Load, display, and share images with other control instances using the ImageList.
1 Prototyping for HCI Spring 2004 (Week 7) Jorge A. Toro.
Getting Started with VB .NET
Advanced Windows Forms Controls and Coding. 2 Objectives Describe and create a Windows Forms application with a Windows Explorer- or Microsoft Outlook-style.
Microsoft Visual Basic 2012 CHAPTER TEN Incorporating Databases with ADO.NET.
Chapter 1 Getting Started With Dreamweaver. Explore the Dreamweaver Workspace The Dreamweaver workspace is where you can find all the tools to create.
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.
CIS 338: ListView Control Dr. Ralph D. Westfall May, 2011.
Windows Programming Using C#
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Web Technologies Website Development Trade & Industrial Education
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Chapter 8: Writing Graphical User Interfaces
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Chapter 12: Using Controls. Examining the IDE’s Automatically Generated Code A new Windows Forms project has been started and given the name FormWithALabelAndAButton.
Website Development with Dreamweaver
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 2 The Visual Basic.NET Integrated Development Environment.
Some Interesting Controls. Controls We've UsedNew Controls LabelListBox TextBoxCheckedListBox ComboBoxTabControl ButtonTabPage Menu MenuItem TreeView.
© 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.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Graphical User Interfaces 2 Tonga Institute of Higher Education.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Exploring the Macromedia Flash Workspace – Lesson 2 1 Exploring the Macromedia Flash Workspace Lesson 2.
© MECHAN 2009 All right reserved. MecGrid W I Z A R D How to be a magician for your MecGrid. Data Visual with W I Z A R D.
Chapter 1 Getting Started With Dreamweaver. Exploring the Dreamweaver Workspace The Dreamweaver workspace is where you can find all the tools to create.
Object-Oriented Application Development Using VB.NET 1 Chapter 10 VB.NET GUI Components Overview.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Graphical User Interfaces Part 2 1 Outline TreeViews ListViews Tab Control.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Dive Into® Visual Basic 2010 Express
Graphical User Interface
Chapter 2: The Visual Studio .NET Development Environment
In this session, you will learn to:
Computing with C# and the .NET Framework
Chapter 12 Buttons and Labels and Scrolls Yi-che Hsu Summer 2002
Chapter 1: An Introduction to Visual Basic 2015
Chapter 8: Writing Graphical User Interfaces
Toolbars and Status Bars
3.01 Apply Controls Associated With Visual Studio Form
Incorporating Databases with ADO.NET
Visual programming Chapter 1: Introduction
3.01 Apply Controls Associated With Visual Studio Form
Getting Started with Dreamweaver
Using Procedures and Exception Handling
Incorporating Databases with ADO.NET
Variables and Arithmetic Operations
Chapter 2 – Introduction to the Visual Studio .NET IDE
Windows Forms GUI: A Deeper Look
Lecture Set 11 Creating and Using Classes
Visual programming Chapter 4: GUI (Graphical User Interface) Part II
Lecture Set 10 Windows Controls and Forms
Building ASP.NET Applications
Using Templates and Library Items
Looping and Multiple Forms TEST REVIEW
Computing Fundamentals Module Lesson 9 — Using Windows Explorer
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

Chapter 22 Tree View and List View Pratyush Rai Yanmei Lan

Tree View Splitter List View

Splitters Used to divide the document into different regions. Used in Microsoft Word to divide the document into different regions. Used in Windows Explorer. Implemented in the Splitter class, which is derived from Control. Associated with a target control through the mechanism of docking.

Docking Control class implements a property named Dock that can be assigned one of the following DockStyle enumeration. Member Value None Top 1 Bottom 2 Left 3 Right 4 Fill 5 If control is an instance of any class descended from Control control.Dock = DockStyle.Left;

.NET DESIGNER Toolbox Form Solution Explorer Properties Window

Docking contd.. What happens when two or more controls are docked against the same side? Behavior determined by the z-order of the controls.

Z- order Characteristics of the control at the top of z-order It is the first control to be assigned its parent property. It is referenced by an index of 0 in the controls property. It is visually on top of all other controls. It is the control closest to the center of the client area when multiple controls are docked against the same edge of the container. Characteristics of the control at the bottom of z-order It is the last control to be assigned its parent property. It is referenced by an index of (Controls.Count-1) in the control collection. It is visually underneath all other controls. If multiple controls are docked against the same edge of the container, it’s the control on the edge.

Docking Examples Panel panel1 = new Panel(); panel1.Parent = this; panel1.Dock = DockStyle.Fill; panel2.Dock = DockStyle.Fill; panel1.Dock = DockStyle.Left; panel2.Dock = DockStyle.Left; panel1 will be visible on top of panel2. The left part of panel2 will be obscured by panel1. Both the panels are completely visible here. panel2 is closer to the left side. panel1 gets pushed towards the center. panel2 is closer to the left side.

Using splitters Splitter used with a single panel – example on page 1050. Splitter used with two panels – example on page 1052.

Designer Drag a panel from the Toolbox on to the form. Set its Dock property to Left using the Properties Window. Drag a splitter on the form. Set its Dock property to Left as well. Drag a second panel on the form. Set its Dock property to Fill.

Splitter Properties Type Property Accessibility int SplitPosition get/set MinSize MinExtra Width BorderStyle Color BackColor Splitter Events Event Method Delegate Argument SplitterMoving OnSplitterMoving SplitterEventHandler SplitterEventArgs SplitterMoved OnSplitterMoved

Tree Views and Tree Nodes TreeView control is most commonly used to display a list of disk drives and directories. They can be used to display any hierarchical information. Bulk of tree view implementation consists of TreeView, TreeNode and TreeNodeCollection classes.

TreeNode An object of type TreeNode is a single entry in the tree view. A TreeNode object is associated with a string and optional image. In Windows Explorer, the string is a drive or directory name, and the images resemble disk drives and folders.

Properties TreeNode Properties (selection) Type Property Accessibility TreeNodeCollection Nodes get TreeNodeCollection Properties Type Property Accessibility TreeNode [] get/set int Count get bool IsReadOnly TreeNodeCollection Methods (selection) TreeNode Add(string strNode) int Add(TreeNode node) void AddRange(TreeNode[] anode)

TreeView TreeView is a collection of top-level (or root) TreeNode objects. TreeView derives from Control, while TreeNode derives from MarshalByRefObject TreeView Properties (selection) Type Property Accessibility TreeNodeCollection Nodes get

Example SimpleTreeView.cs on page 1062 Each of the Add methods in the code creates a TreeNode object. tree.Nodes[0].Nodes.Add(“Dog”) – the first part of the statement refers to the first TreeNode object, that is “Animal”. The second Nodes property is the collection of child TreeNode objects of “Animals”.

Images in Tree Views TreeView Properties (selection) Type Property Accessibility bool ShowPlusMinus get/set ShowLines ShowRootLines TreeView Properties (selection) Type Property Accessibility ImageList get/set int ImageIndex SelectedImageIndex

TreeNode Constructors TreeNode(string strNode) TreeNode(string strNode, TreeNode[] anodes) TreeNode(string strNode, int indexImage, int indexImageSelected) TreeNode(string strNode, int indexImage, int indexImageSelected, TreeNode[] anodes)

Tree View Events The TreeNode class doesn’t define any events on its own. However, TreeView implements 11 events in addition to the ones it inherits from Control. Here are the 6 crucial ones: Event Method Delegate Argument BeforeExpand OnBeforeExpand TreeViewCancelEventHandler TreeViewCancelEventArgs BeforeCollapse OnBeforeCollapse BeforeSelect OnBeforeSelect AfterExpand OnAfterExpand TreeViewEventHandler TreeViewEventArgs AfterCollapse OnAfterCollapse AfterSelect OnAfterSElect

Node Navigation TreeNode Properties (selection) Type Property Accessibility TreeView get int Index string Text get/set object Tag The following properties are read-only Type Property Accessibility TreeNode Parent get FirstNode LastNode NextNode PrevNode

Node Navigation contd.. TreeNode Properties (selection) Type Property Accessibility bool IsExpanded get IsSelected string FullPath

Directory Tree DirectoryTreeView.cs on Page 1070. DirectoriesAndFiles.cs on Page 1074. In DirectoryTreeView.cs, RefreshTree method calls AddDirectory to display the plus sign that allows the user to expand the node.

List View ListView control displays textual information in rows and columns with column headings. First column of information contains the list view items, and the other columns contain sub items associated with each item.

ListView Properties ListView Properties (selection) View Enumeration Type Property Accessibility View get/set ImageList SmallImageList LargerImageList ListView.ColumnHeaderCollection Columns get ListView.ListViewItemCollection Items View Enumeration Member Value LargeIcon Details 1 SmallIcon 2 List 3

Properties contd.. ListView.ColumnHeaderCollection Properties Type Property Accessibility ColumnHeader [] get int Count bool IsReadOnly ListView.ColumnHeaderCollection Methods (selection) int Add(ColumnHeader colhead) ColumnHeader Add(string strText, int iWidth, HorizontalAlignment ha) void AddRange(ColumnHeader[] acolheads)

Properties (again) ListView.ListViewItemCollection Properties Type Property Accessibility ListViewItem [] Get/set int Count get bool IsReadOnly ListView. ListViewItemCollection Methods (selection) ListViewItem Add(ListViewItem lvitem) ListViewItem Add(string strItem) ListViewItem Add(string strItem, int indexImage) void AddRange(ListViewItem[] alvitems)

List View Events ListView Properties (selection) Type Property Accessibility ItemActivation Activation get/set ItemActivation Enumeration Member Value Standard OneClick 1 TwoClick 2

List View Events ListView Events (selection) Event Method Delegate Argument SelectedIndexChanged OnSelectedIndexChanged EventHandler EventArgs ItemActivate OnItemActivate ColumnClick OnColumnClick ColumnClickEventHandler ColumnClickEventArgs

Example Windows Explorer type application – page 1097.