vel22.htm
来自「简单的说明如何使用VB,非常适合初学使用者,而且是用图表来解说的」· HTM 代码 · 共 1,821 行 · 第 1/3 页
HTM
1,821 行
5-Dash-Dot-Dot</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DASH_DOT_DOT</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>The line is comprised of a series of one dash followed by two dots</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>6-Inside Solid</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>INSIDE_SOLID</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Same as 1-Solid for lines</FONT></TABLE><P>Figure 22.3 shows how various BorderStyle settings affect the lines that you draw. The BorderStyle determines how a series of dashes and dots comprise the line's pattern. (Is this Morse code we're speaking here?)<BR><P><B> <A HREF="22vel03.gif">Figure 22.3. Affects of the </B><B>BorderStyle</B><B> properties.</A></B><BR><P>To draw a line, double-click the line control on the toolbox. A line appears in the center of the form with two handles on each end. To move the line to a different location, drag the center of the line with the mouse. To lengthen or shorten the line, drag either handle on the line. You can raise and lower either end of the line by dragging either end's handle with the mouse.<BR><P><B>Tip: </B>After you position the line with the mouse in the approximate location you need the line to appear, you can fine-tune the line's size and location by setting the various property values. If you're a patient programmer, you can even animate the lines by changing the X1, X2, Y1, and Y2 property settings repeatedly through code.<P><FONT COLOR="#FF8000"><B><I>Stop and Type: </I></B></FONT>Figure 22.4 contains the Form window that might be used by a local hardware store for its regular program screen. The entire house was drawn using a series of lines. You can find this form inside the MOMPOP.MAK application on this book's disk.<BR><BLOCKQUOTE><BLOCKQUOTE><HR ALIGN=CENTER><BR><NOTE><B>Note: </B>The only function connected to this form is the End statement inside the cmdExit_Click() command button's event procedure.</NOTE><BR><HR ALIGN=CENTER></BLOCKQUOTE></BLOCKQUOTE><P><B> <A HREF="22vel04.gif">Figure 22.4. Lines add eye-catching glamour to a dull form.</A></B><BR><P><FONT COLOR="#FF8000"><B><I>Review: </I></B></FONT>By using the line control and specifying various property values, you can draw shapes on the form's background.<BR><BR><A NAME="E68E168"></A><H3 ALIGN=CENTER><CENTER><FONT SIZE=5 COLOR="#FF0000"><B>Mastering the Shape Control</B></FONT></CENTER></H3><BR><P><FONT COLOR="#FF8000"><B><I>Concept: </I></B></FONT>The shape control gives you the ability to draw six different kinds of figures on the form. The various shading and color properties help you distinguish one shape from another.<BR><P>Table 22.3 contains the properties available for the shape control. The most important property is the Shape property. The Shape property gives a shape one of the six fundamental shapes.<BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 22.3. The shape control 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 a hexadecimal Windows color value that determines the background color of the shape.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>BackStyle</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains either 0-Transparent (the default) or 1-Opaque that determines whether the background of the form appears through the shape or if the shape hides whatever it covers.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>BorderColor</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies a hexadecimal Windows color value that determines the color of the shape's bordering edges.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>BorderStyle</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains one of seven values that specifies the pattern of the shape's border. Table 22.2's line control's BorderStyle values provide the shape's BorderStyle possible values as well. The default value is 1-Solid. The BorderStyle has no effect on shapes with a BorderWidth greater than one twip.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>BorderWidth</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the size, in twips, that the shape's outline takes.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DrawMode</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>An advanced style that determines how the bit patterns of the shape interact with the surrounding form's bit appearance. The default value, 13 - Copy Pen, works well for virtually all Visual Basic applications.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>FillColor</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies a hexadecimal Windows color value that determines the color of the shape's interior lines.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>FillStyle</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains one of eight values that specifies the pattern of lines with which Visual Basic paints the interior of the shape. Table 22.4 contains the possible values for the shape's FillStyle. The default FillStyle value is 0-Solid.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Height</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the number of twips high that the shape takes (from the highest point to the lowest point in the shape).</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Index</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the subscript of the shape control if the shape control is part of a control array.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Left</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the number of twips from the form's left edge to the shape's leftmost edge.</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 shape control. Visual Basic names the line controls Shape1, Shape2, and so on, unless you rename the shape controls.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Shape</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains one of six values that specifies the type of shape that the shape control takes on. Table 22.5 contains the possible values for the shape's Shape property. The default Shape property is 0-Rectangle.</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 shape control.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Top</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the number of twips from the form's top edge to the shape's highest edge.</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 the shape control.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Width</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the number of twips wide that the shape takes (at the widest axis).</FONT></TABLE><P>Table 22.4 contains the possible values for the shape control's FillStyle property. Figure 22.5 shows you the various fill patterns that a shape can contain.<BR><P><B> <A HREF="22vel05.gif">Figure 22.5. The </B><B>FillStyle</B><B> determines how the shapes' interiors appear.</A></B><BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 22.4. The shape control's </B><B>FillStyle</B><B> values.</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>Value</I></FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>CONSTANT.TXT Name</I></FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>Description</I></FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>0-Solid</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>SOLID</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Solid color fill with no pattern</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>1-Transparent</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>TRANSPARENT</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>The shape appears as an outline only</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>2-Horizontal Line</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>HORIZONTAL_LINE</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Horizontal lines fill the shape</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>3-Vertical Line</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>VERTICAL_LINE</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Vertical lines fill the shape</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>4-Upward Diagonal</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>UPWARD_DIAGONAL</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Upward diagonal lines fill the shape</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>5-Downward Diagonal</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DOWNWARD_DIAGONAL</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Downward diagonal lines fill the shape</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>6-Cross</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>CROSS</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Crosshairs fill the shape</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>7-Diagonal Cross</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DIAGONAL_CROSS</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Diagonal crosshairs fill the shape</FONT></TABLE><P>Table 22.5 contains the possible values for the shape control's Shape property. Figure 22.2 showed you the various shapes that the shape controls can take on. Therefore, when you want to place a square on a form, you'll place the shape control on the form and set the Shape property to 1-Square.<BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 22.5. The shape control's </B><B>Shape</B><B> 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>Value</I></FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>CONSTANT.TXT Name</I></FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>Description</I></FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>0-Rectangle</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>SHAPE_RECTANGLE
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?