vel17.htm

来自「简单的说明如何使用VB,非常适合初学使用者,而且是用图表来解说的」· HTM 代码 · 共 2,041 行 · 第 1/4 页

HTM
2,041
字号
<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>TabStop</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains True if the user can press Tab to move the focus to this file list box. If False, the file list box can't receive the focus.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Tag</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Unused by Visual Basic. This is for the programmer's use for an identifying comment applied to the file list box.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Top</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds the number of twips from the top edge of a file list box to the top of the form.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Visible</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains either True or False, indicating whether the user can see (and, therefore, use) the file list box.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Width</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds the number of twips wide that the file list box consumes.</FONT></TABLE><P>Table 17.3 lists the properties that appear in the Properties window for the directory list box control. Many of the properties are similar to the ones that you've learned for other controls. As with the file list control, you can set and select values from directory list boxes at runtime.<BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 17.3. The directory list box properties.</B></FONT></CENTER><BR><TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 ><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>Property</I></FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>Description</I></FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>BackColor</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the directory list box's background color, chosen as a hexadecimal color code or from the color palette.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>DragIcon</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the icon that appears when the user drags the directory list box around on the form. (You'll only rarely let the user move a directory list box, so the Drag... property settings aren't usually relevant.)</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>DragMode</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains either 1 for manual mouse dragging requirements (the user can press and hold the mouse button while dragging the control) or 0 (the default) for automatic mouse dragging, meaning that the user can't drag the directory list box but you, through code, can initiate the dragging if needed.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Enabled</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies that the directory list box can respond to events if set to True (the default). If set to False, Visual Basic halts event processing for that particular control.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>FontBold</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds True (the default) if the directory names are to display in boldfaced characters; False otherwise.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>FontItalic</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds True (the default) if the directory names are to display in italicized characters; False otherwise.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>FontName</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains the name of the directory list box directory name's styles. Typically, you'll use the name of a Windows TrueType font.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>FontSize</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the size, in points, of the font used for the directory names.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>FontStrikethru</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds True (the default) if the directory names are to display in strikethru letters (characters with dashes through them); False otherwise.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>FontUnderline</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds True (the default) if the directory names are to display in underlined letters; False otherwise.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>ForeColor</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the color of the letters in the directory names.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Height</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds the height, in twips, of the directory list box.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>HelpContextID</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>If you add advanced, context-sensitive help to your application, the HelpContextID provides the identifying number for the help text.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Index</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>If the directory list box is part of a control array, the Index property provides the numeric subscript for each particular directory list box. (See Lesson 6.)</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Left</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds the number of twips from the left edge of the Form window to the left edge of the directory list box.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>MousePointer</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the shape that the mouse cursor changes to if the user moves the mouse cursor over the directory list box. The possible values are from 0 to 12 and represent a range of different shapes that the mouse cursor can take. (See Lesson 12.)</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Name</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains the name of the control. By default, Visual Basic generates the names Dir1, Dir2, and so on as you add subsequent directory list boxes to the form.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>TabIndex</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies that the focus tab order begins at 0 and increments every time you add a new control. You can change the focus order by changing the controls' TabIndex to other values. No two controls on the same form can have the same TabIndex value.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>TabStop</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>If True, specifies that the user can press Tab to move the focus to this directory list box. If False, the directory list box can't receive the focus.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Tag</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Unused by Visual Basic. This is for the programmer's use for an identifying comment applied to the directory list box.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Top</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds the number of twips from the top edge of a directory list box to the top of the form.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Visible</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds True or False, indicating whether the user can see (and, therefore, use) the directory list box.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Width</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Holds the number of twips wide that the directory list box consumes.</FONT></TABLE><BLOCKQUOTE><BLOCKQUOTE><HR ALIGN=CENTER><BR><NOTE><B>Note: </B>At runtime, you can set the directory list box's Path property. The Path property contains the name of the disk drive as well as the full path.</NOTE><BR><HR ALIGN=CENTER></BLOCKQUOTE></BLOCKQUOTE><P>Most of the file-related controls are common and control the placement, size, and look of controls. However, you'll have to constantly update the values of key properties for these file-related controls as the user selects different values from the controls.<BR><P>For example, when the user selects a different drive name, you'll have to update both the directory control's list of directories as well as the file list control's list of filenames. When the user selects a different directory, you'll have to update the file list control's list of filenames but not change the drive list control. Keeping these file controls in sync is the only unusual requirement for using these controls. The next section explains how the FILESEL.MAK application uses code to tie together its file controls.<BR><BLOCKQUOTE><BLOCKQUOTE><HR ALIGN=CENTER><BR><NOTE><B>Note: </B>The events available for the file controls are extremely similar to those that you've seen. The most commonly coded event procedures are Click and DblClick. In addition, the drive and directory list boxes support the Change event procedure that executes when the user changes the drive or directory in some way.</NOTE><BR><HR ALIGN=CENTER></BLOCKQUOTE></BLOCKQUOTE><P><FONT COLOR="#FF8000"><B><I>Review: </I></B></FONT>Although many properties for the file-related controls are similar to those that you know from other controls, there are a few key properties that determine the selection from which the user can select filenames. The following properties are especially critical:<BR><UL><LI>The drive list box control's Drive property<BR><BR><LI>The directory list box control's Path property<BR><BR><LI>The filename list box control's Pattern property<BR><BR></UL><P>The next section shows how the FILESEL.MAK application keeps these controls in synchronization while the user selects among drives, directories, and files.<BR><BR><A NAME="E68E130"></A><H3 ALIGN=CENTER><CENTER><FONT SIZE=5 COLOR="#FF0000"><B>How FILESEL.MAK Manages the File Selection</B></FONT></CENTER></H3><BR><P><FONT COLOR="#FF8000"><B><I>Concept: </I></B></FONT>When one file selection control changes, such as the drive list box control, that change usually affects the other file controls. You must learn how to code file controls to keep them all pointing to the same drive, directory, and file.<BR><P>When the user clicks the Display Files command button, the Click event procedure in Listing 17.1 executes to set up the default drive and path.<BR><P><FONT COLOR="#000080"><B>Listing 17.1. The initial code for the file-selection frame's display.</B></FONT>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?