vel06.htm
来自「简单的说明如何使用VB,非常适合初学使用者,而且是用图表来解说的」· HTM 代码 · 共 2,468 行 · 第 1/4 页
HTM
2,468 行
</TABLE><P>Table 6.5 describes the events available for the label controls that you place on forms.<BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 6.5. Label control events.</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>Event</I></FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>Description</I></FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Change</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the label's Caption property changes.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Click</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user clicks the label with the mouse.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DblClick</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user double-clicks the label with the mouse.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DragDrop</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a drag operation of the label completes.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DragOver</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs during a drag operation of the label.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkClose</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation terminates.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkError</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation fails.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkNotify</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation notifies the label with a changed message.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkOpen</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation begins.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>MouseDown</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user presses the mouse button over the label.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>MouseMove</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user moves the mouse over the label.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>MouseUp</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user releases the mouse over the label.</FONT></TABLE><P>Note that no GotFocus event is associated with labels. This is because a label can never receive the focus.<BR><P>Table 6.6 describes the events available for the text box controls that you place on forms.<BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR="#000080"><B>Table 6.6. Text box control events.</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>Event</I></FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><I>Description</I></FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Change</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the text box's Text property changes.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DragDrop</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a drag operation of the text box completes.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>DragOver</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs during a drag operation of the text box.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>GotFocus</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the text box receives the focus.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>KeyDown</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user presses a key and the KeyPreview property for the controls on the form is set to True. Otherwise, the form gets the KeyDown event.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>KeyPress</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user presses a key over the text box.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>KeyUp</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the user releases a key over the text box.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkClose</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation terminates.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkError</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation fails.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkNotify</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation notifies the text box with a changed message.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LinkOpen</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when a DDE operation begins.</FONT><TR><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>LostFocus</FONT><TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>Occurs when the text box loses the focus to another object.</FONT></TABLE><P><FONT COLOR="#FF8000"><B><I>Review: </I></B></FONT>Each control has its own set of properties and command buttons. The tables in this unit complete the discussion of forms, command buttons, labels, and text boxes. You now know enough to work with these four fundamental Visual Basic objects. The next lesson builds on your knowledge by teaching you how to add code to event procedures.<BR><BR><A NAME="E68E53"></A><H3 ALIGN=CENTER><CENTER><FONT SIZE=5 COLOR="#FF0000"><B>Homework</B></FONT></CENTER></H3><BR><BR><A NAME="E69E42"></A><H4 ALIGN=CENTER><CENTER><FONT SIZE=4 COLOR="#FF0000"><B>General Knowledge</B></FONT></CENTER></H4><BR><OL><LI>Is the form an object?<BR><BR><LI>True or false: Label controls can have more than one line of text as long as you set the MultiLine property.<BR><BR><LI>What is a pixel?<BR><BR><LI>Which form property determines how the form appears when the user first sees the form?<BR><BR><LI>What does <I>truncate</I> mean?<BR><BR><LI>True or false: Suppose that you want to store a lot of text in a label. You must make the label large enough to hold the entire text if the user is to see all of it.<BR><BR><LI>True or false: You can add both horizontal and vertical scroll bars to a label.<BR><BR><LI>How can you ensure that a label does not expand to display a long value?<BR><BR><LI>True or false: You can enter an initial multiline text value by using the Properties window.<BR><BR><LI>True or false: A label can get the focus as long as you supply an access shortcut key for the label.<BR><BR><LI>Which property determines the focus order?<BR><BR><LI>What is perhaps the most important form event?<BR><BR><LI>Which form event occurs first: Load or Activate?<BR><BR><LI>What window can you use to see all the events for objects?<BR><BR><LI>Why is there no GotFocus event for labels?<BR><BR></OL><BR><A NAME="E69E43"></A><H4 ALIGN=CENTER><CENTER><FONT SIZE=4 COLOR="#FF0000"><B>Write Code That...</B></FONT></CENTER></H4><BR><OL><LI>Suppose that you were writing a Change event procedure for a text box label called txtLastName. What you name the event procedure?<BR><BR><LI>When the user presses a key, either the form gets the keystroke or a control gets the keystroke. What property determines which object gets the keystroke?<BR><BR><LI>Suppose that you need to change a form's title in the form's title bar. Which property do you change—the Caption property or the Name property?<BR><BR><LI>Describe how you add access keystrokes to text boxes.<BR><BR></OL><BR><A NAME="E69E44"></A><H4 ALIGN=CENTER><CENTER><FONT SIZE=4 COLOR="#FF0000"><B>Find the Bug</B></FONT></CENTER></H4><BR><OL><LI>Why should you avoid putting too many self-sizing labels on the form at one time?<BR><BR><LI>What happens if you set the AutoSize property to True before you set the WordWrap property to True?<BR><BR></OL><BR><A NAME="E69E45"></A><H4 ALIGN=CENTER><CENTER><FONT SIZE=4 COLOR="#FF0000"><B>Extra Credit</B></FONT></CENTER></H4><BR><P>What if you wanted to enter Property window settings in inches instead of twips, the default unit of measurement. How do you change the unit measurement to inches?<BR><P ALIGN=LEFT><A HREF="vel05.htm" TARGET="_self"><IMG SRC="purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A><A HREF="#I0" TARGET="_self"><IMG SRC="purtop.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Page Top"></A><A HREF="index.htm" TARGET="_self"><IMG SRC="purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A><A HREF="velp03.htm" TARGET="_self"><IMG SRC="purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?