Visual Basic 6 Black Book:Image Lists, Tree Views, List Views, And Tab Strips
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Chapter 16Image Lists, Tree Views, List Views, And Tab Strips
If you need an immediate solution to:
Adding An Image List To A Form
Adding Images To Image Lists
Using The Images In Image Lists
Setting Image Keys In An Image List
Adding A Tree View To A Form
Selecting Tree View Styles
Adding Nodes To A Tree View
Adding Subnodes To A Tree View
Adding Images To A Tree View
Expanding And Collapsing Nodes (And Setting Node Images To Match)
Handling Tree View Node Clicks
Adding A List View To A Form
Adding Items To A List View
Adding Icons To List View Items
Adding Small Icons To List View Items
Selecting The View Type In List Views
Adding Column Headers To A List View
Adding Column Fields To A List View
Handling List View Item Clicks
Handling List View Column Header Clicks
Adding A Tab Strip To A Form
Inserting Tabs Into A Tab Strip Control
Setting Tab
Setting Tab Images
Using A Tab Strip To Display Other Controls
Handling Tab Clicks
In Depth
In this chapter, were going to take a look at image list controls and some of the controls that use image lists: tree views, list views, and tab strips. These controls are part of the Windows common controls package and are being used more and more frequently in Windows programs.
Well get an overview of each control before tackling the programming issues. You add all the controls in this chapter to the Visual Basic toolbox by selecting the Project|Components menu item, clicking the Controls tab in the dialog box that opens, selecting the entry marked Windows Common Controls, and clicking on OK to close the Components dialog box.
Image Lists
Image list controls are invisible controls that serve one purpose: to hold images that are used by other controls. Usually, you add images to an image list control at design time, using the Insert Picture button in the controls property pages. You can also add images to an image list at runtime, using the Add method of its internal image collection, ListImages.
To use the images in the image list, you usually associate the image list with a Windows common control (which has an ImageList property). For each item in the common control, such as a tab in a tab strip control, you can then specify either an index into the image lists ListImages collection or an images key value to associate that image with the item.
You can also reach the images in an image list with the ListImages collections Picture property. For example, if you wanted to use an image list with a control thats not a Windows common control, such as a picture box, you can assign the first image in the image control to that picture box this way:
Picture1.Picture = ImageList1.ListImages(1).Picture
The Image List Control tool appears in the Visual Basic toolbox in Figure 16.1 at bottom, on the right.
Figure 16.1 The Image List Control tool.
Tree Views
If youve used the Windows Explorer, youre familiar with tree views. Tree views present data in a hierarchical way, such as the view of directories that appears in the tree view at left in the Windows Explorer, as shown in Figure 16.2.
Figure 16.2 The Windows Explorer.
Trees are composed of cascading branches of nodes , and each node usually consists of an image (set with the Image property) and a label (set with the Text property). Images for the nodes are supplied by an image list control associated with the tree view control.
A node can be expanded or collapsed, depending on whether or not the node has child nodes. At the topmost level are root nodes, and each root node can have any number of child nodes. Each node in a tree is actually a programmable Node object, which belongs to the Nodes collection. As with other collections, each member of the collection has a unique Index and Key property that allows you to access the properties of the node.
The Tree View Control tool is the thirteenth tool down on the right in Figure 16.3.
Figure 16.3 The Tree View Control tool.
List Views
The list view control displays, as its name implies, lists of items. You can see a list view at right in the Windows Explorer in Figure 16.2. There, the list view is displaying a list of files. Each item in a list view control is itself a ListItem object and can have both text and an image associated with it. The ListItem objects are stored in the list views ListItems collection.
List views can display data in four different view modes:
Icon modeCan be manipulated with the mouse, allowing the user to drag and drop and rearrange objects.
SmallIcon modeAllows more ListItem objects to be viewed. Like the Icon view mode, objects can be rearranged by the user.
List modePresents a sorted view of the ListItem objects.
Report modePresents a sorted view, with sub-items, allowing extra information to be displayed.
The list view in the Windows Explorer in Figure 16.2 is displaying files in Report view mode (which is the only mode that has columns and column headers). In this mode, you add sub-items to each item, and the text in those sub-items will appear under the various column headings.
You usually associate two image list controls with a list view: one to hold the icons for the Icon view mode, and one to hold small icons for the other three modes. The size of the icons you use is determined by the image list control (the available sizes are 16 × 16, 32 × 32, 48 × 48, and Custom).
The List View Control tool is the fourteenth control down on the left in Figure 16.4.
Figure 16.4 The List View Control tool.
Tab Strips
A tab strip control presents the user with a row (or rows) of tabs that acts like the dividers in a notebook or the labels on a group of file folders. Like an increasing number of other controls (such as coolbars and tree views), tab strips represent one of Microsofts attempts to compact data into less and less of the screen (because theres getting to be more and more data). Using tab strips, the user can click a tab and see a whole new panel of data, like opening a file folder. In fact, weve already used tab strips in many parts of this book already to set Visual Basic options or to include ActiveX controls in our programs.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
499 510499 19499 15demo cgi 504504 Co reguluje instrukcja obiegu dokumentów499 Ewidencja kosztów wyłacznie na kontach zespołu 4 a zmiana stanu produktówindex (504)więcej podobnych podstron