30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

534 Graphical User Interfaces Concepts: Part 2 Chapter 13<br />

a manner similar <strong>to</strong> that of the event handlers for the Color menu items. Each event handler<br />

clears the Checked properties for all font-type menu items by calling method ClearFont<br />

(lines 118–124), then sets the Checked property of the menu item that raised the event <strong>to</strong><br />

True. This enforces the mutual exclusion of the font-type menu items.<br />

The event handlers for the Bold and Italic menu items (lines 166–191) use the bitwise<br />

Xor opera<strong>to</strong>r. For each font style, the Xor opera<strong>to</strong>r changes the text <strong>to</strong> include the style or,<br />

if that style is already applied, <strong>to</strong> remove it. The <strong>to</strong>ggling behavior provided by the Xor<br />

opera<strong>to</strong>r is explained in Chapter 12, Graphical User Interfaces Concepts: Part 1. As<br />

explained in Chapter 12, this program’s event-handling structure allows the programmer <strong>to</strong><br />

add and remove menu entries while making minimal structural changes <strong>to</strong> the code.<br />

13.3 LinkLabels<br />

The LinkLabel control displays links <strong>to</strong> other resources, such as files or Web pages<br />

(Fig. 13.6). A LinkLabel appears as underlined text (colored blue by default). When the<br />

mouse moves over the link, the pointer changes <strong>to</strong> a hand; this is similar <strong>to</strong> the behavior of<br />

a hyperlink in a Web page. The link can change color <strong>to</strong> indicate whether the link is new,<br />

previously visited or active. When clicked, the LinkLabel generates a LinkClicked<br />

event (see Fig. 13.7). Class LinkLabel is derived from class Label and therefore inherits<br />

all of class Label’s functionality.<br />

Look-and-Feel Observation 13.5<br />

Although other controls can perform actions similar <strong>to</strong> those of a LinkLabel (such as the<br />

opening of a Web page), LinkLabels indicate that a link can be followed—a regular label<br />

or but<strong>to</strong>n does not necessarily convey that idea. 13.5<br />

LinkLabel<br />

on a form Hand image displays when<br />

mouse moves over LinkLabel<br />

Fig. 13.6 LinkLabel control in running program.<br />

LinkLabel<br />

properties and events Description / Delegate and Event Arguments<br />

Common Properties<br />

ActiveLinkColor Specifies the color of the active link when clicked. Red is the default.<br />

LinkArea Specifies which portion of text in the LinkLabel is part of the link.<br />

Fig. 13.7 LinkLabel properties and events (part 1 of 2).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!