"Pro ASP.NET 3.5 Server Controls and AJAX Components"
The FancyLabel Style Web Form Code-Behind Class File using System; using System.Web.UI.HtmlControls; namespace ControlsBook2Web.Ch04 { public partial class FancyLabelStyle : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { AddCssLinktoHeader(); if (!Page.IsPostBack) { AutoLabel.Cursor = ControlsBook2Lib.Ch04.CursorStyle.auto; CrosshairLabel.Cursor = ControlsBook2Lib.Ch04.CursorStyle.crosshair; HandLabel.Cursor = ControlsBook2Lib.Ch04.CursorStyle.hand; HelpLabel.Cursor = ControlsBook2Lib.Ch04.CursorStyle.help; MoveLabel.Cursor = ControlsBook2Lib.Ch04.CursorStyle.move; TextLabel.Cursor = ControlsBook2Lib.Ch04.CursorStyle.text; WaitLabel.Cursor = ControlsBook2Lib.Ch04.CursorStyle.wait; } } private void AddCssLinktoHeader() { HtmlLink cssRef = new HtmlLink(); cssRef.Href = "../Ch04/WebControlStyle.css"; cssRef.Attributes.Add("rel", "stylesheet"); cssRef.Attributes.Add("type", "text/css"); Header.Controls.Add(cssRef); } } } Figure 4-18 shows what the web form looks like when it??™s rendered. CHAPTER 4 ?– THE WEBCONTROL BASE C LASS AND CONTROL STYLES 177 Figure 4-18. The FancyLabel Style web form The following HTML fragment shows the rendered tags and their style attributes for the CSS cursor property:
style="cursor:auto;">Auto cursor set
style="cursor:crosshair;">Crosshair cursor set
style="cursor:hand;">Hand cursor set 178 CHAPTER 4 ?– T HE WEBCONTROL BASE CLASS AND CONTROL S TYLES