vel22.htm

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

HTM
1,821
字号
<HTML><HEAD><TITLE>Visual Basic in 12 Easy Lessons vel22.htm </TITLE><LINK REL="ToC" HREF="index.htm"><LINK REL="Index" HREF="htindex.htm"><LINK REL="Next" HREF="velp11.htm"><LINK REL="Previous" HREF="vel21.htm"></HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080"><A NAME="I0"></A><H2>Visual Basic in 12 Easy Lessons vel22.htm</H2><P ALIGN=LEFT><A HREF="vel21.htm" TARGET="_self"><IMG SRC="purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A><A HREF="index.htm" TARGET="_self"><IMG SRC="purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A><A HREF="velp11.htm" TARGET="_self"><IMG SRC="purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A><HR ALIGN=CENTER><P><UL><UL><UL><LI><A HREF="#E68E165" >What You'll Learn</A><LI><A HREF="#E68E166" >The Line and Shape Controls</A><LI><A HREF="#E68E167" >Mastering the Line Control</A><LI><A HREF="#E68E168" >Mastering the Shape Control</A><LI><A HREF="#E68E169" >If You Have Graphics Files...</A><LI><A HREF="#E68E170" >Homework</A><UL><LI><A HREF="#E69E155" >General Knowledge</A><LI><A HREF="#E69E156" >Find the Bug</A><LI><A HREF="#E69E157" >What's the Output?</A><LI><A HREF="#E69E158" >Write Code That...</A><LI><A HREF="#E69E159" >Extra Credit</A></UL></UL></UL></UL><HR ALIGN=CENTER><A NAME="E66E32"></A><H1 ALIGN=CENTER><CENTER><FONT SIZE=6 COLOR="#FF0000"><B>Lesson 11, Unit 22</B></FONT></CENTER></H1><BR><A NAME="E67E35"></A><H2 ALIGN=CENTER><CENTER><FONT SIZE=6 COLOR="#FF0000"><B>Glitzy Graphics</B></FONT></CENTER></H2><BR><BR><A NAME="E68E165"></A><H3 ALIGN=CENTER><CENTER><FONT SIZE=5 COLOR="#FF0000"><B>What You'll Learn</B></FONT></CENTER></H3><BR><UL><LI>The line and shape controls<BR><BR><LI>Mastering the line control<BR><BR><LI>Mastering the shape control<BR><BR><LI>If you have graphics files...<BR><BR></UL><P>Most Visual Basic programmers enjoy learning and using the material presented in this lesson. This lesson searches for that artist deep within every programmer! This lesson explores the graphics controls available to you as a Visual Basic programmer.<BR><P>Perhaps you won't be drawing pretty pictures on every application's form that you design, but knowing how to draw lines and circles often allows you to spruce up a form by separating controls and enclosing labels within colored ovals to highlight important information.<BR><BR><A NAME="E68E166"></A><H3 ALIGN=CENTER><CENTER><FONT SIZE=5 COLOR="#FF0000"><B>The Line and Shape Controls</B></FONT></CENTER></H3><BR><P><FONT COLOR="#FF8000"><B><I>Concept: </I></B></FONT>The line and shape controls work together to draw lines, boxes, and all kinds of circular figures on the form. By placing the controls and setting appropriate properties, you'll be adding flair to applications.<BR><P>Figure 22.1 shows the location of the line and shape controls on the Toolbox window. The properties of each control that you place on your form determine exactly what kind of image the control becomes.<BR><P><B> <A HREF="22vel01.gif">Figure 22.1. The line and shape controls provide Visual Basic's artistic tools.</A></B><BR><P>Here are the primary graphic images that you can draw with the line and shape controls:<BR><UL><LI>Lines<BR><BR><LI>Rectangles<BR><BR><LI>Squares<BR><BR><LI>Ovals<BR><BR><LI>Circles<BR><BR><LI>Rounded rectangles<BR><BR><LI>Rounded squares<BR><BR></UL><P>Figure 22.2 shows each of these seven primary images. By combining these fundamental geometric images and setting appropriate color and size properties, you can draw virtually anything you need to draw on the form.<BR><P><B> <A HREF="22vel02.gif">Figure 22.2. The seven fundamental images that you can draw.</A></B><BR><P>Use the line control for drawing lines of various widths, lengths, and patterns. The shape control handles the drawing for all the other fundamental shapes.<BR><P><FONT COLOR="#FF8000"><B><I>Review: </I></B></FONT>The line and shape controls are the primary drawing controls. There are seven fundamental geometric shapes that you can draw. By specifying various properties, you can control how those shapes appear on the form.<BR><BR><A NAME="E68E167"></A><H3 ALIGN=CENTER><CENTER><FONT SIZE=5 COLOR="#FF0000"><B>Mastering the Line Control</B></FONT></CENTER></H3><BR><P><FONT COLOR="#FF8000"><B><I>Concept: </I></B></FONT>The line control contains properties that specify the width and length of lines that you draw. In addition, you can change the pattern of each line that you draw.<BR><P>Table 22.1 lists the property values for the line control. The BorderStyle property requires its own table for explanation. Table 22.2 contains the values that you can specify for the BorderStyle. The BorderStyle property determines the pattern that Visual Basic uses to draw the line. By specifying various BorderStyle values, you can vary the line pattern. If you assign a BorderStyle property at runtime, you either can specify a number that represents the BorderStyle, or use one of the constants defined in the CONSTANT.TXT file.<BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 22.1. The line 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>BorderColor</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies a hexadecimal Windows color value that determines the color of the line.</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 drawn line. See Table 22.2 for available BorderStyle values. The default value is 1-Solid. The BorderStyle has no effect on lines 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 line 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 line 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>Index</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Specifies the subscript of the line control if the line control is part of a control array.</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 line control. Visual Basic names the line controls Line1, Line2, and so on, unless you rename the line controls.</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 line control.</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 line control.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>X1</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains the number of twips from the left of the Form window to the start of the line.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>X2</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains the number of twips from the left of the Form window to the end of the line.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Y1</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains the number of twips from the top of the Form window to the left starting point of the line.</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Y2</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Contains the number of twips from the top of the Form window to the lower ending point of the line.</FONT></TABLE><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 22.2. The line control's </B><B>BorderStyle</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-Transparent</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>TRANSPARENT</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>Background comes through the line</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>1-Solid</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>SOLID</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>The line is a solid line</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>2-Dash</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>DASH</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>The line is comprised of dashes</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>3-Dot</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>DOT</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>The line is comprised of dots</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>4-Dash-Dot</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>DASH_DOT</FONT><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>The line is comprised of a series of dashes followed by dots</FONT><TR><TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

⌨️ 快捷键说明

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