tailieunhanh - Windows Web Sever Strack

Pop-Up Menus Many Windows applications make use of pop-up menus that appear when you right-click a form or control. These menus are usually context-sensitive and display commands that are applicable only to the control or form that currently has the focus. | Pop-Up Menus Many Windows applications make use of pop-up menus that appear when you right-click a form or control. These menus are usually context-sensitive and display commands that are applicable only to the control or form that currently has the focus. They are sometimes referred to as context menus. Creating Pop-Up Menus In the following exercises you will create two pop-up menus. The first pop-up menu is attached to the firstName and lastName text box controls and allows the user to clear these controls. The second pop-up menu is attached to the form and contains commands for saving the currently displayed member s information and for clearing the form. To do this you will make a copy of an existing menu item as well as create a new one. Create the firstName and lastName pop-up menus 1. In the Design View window displaying MemberForm drag a ContextMenuStrip control from the Menus Toolbars category in the Toolbox and drop it on the form. A ContextMenuStrip object called contextMenuStripl appears at the bottom of the form and another menu strip appears at the top of the form. Note that this is only a temporary location for this new menu strip it is just placed there by Visual Studio 2005 to allow you to edit it and add menu items. At runtime its location will actually be determined by the position of the mouse when the user clicks the right mouse button. 2. Select the contextMenuStripl control type textBoxMenu in the Name text box in the Properties window and then press Enter. 3. Click the Type Here caption that appears under the ContextMenuStrip menu strip at the top of the form not the control . Type Clear Text and then press Enter TIP If the ContextMenuStrip menu strip has disappeared from the form click the textBoxMenu control underneath the form to display it again. 4. Click the firstName text box control next to the First Name label . In the Properties window change the ContextMenuStrip property to textBoxMenu. The ContextMenu property determines which .

TÀI LIỆU LIÊN QUAN
10    158    1
6    184    1
7    162    1
5    157    1
6    160    1
6    152    1
6    150    1
6    206    1
7    154    1