zoukankan      html  css  js  c++  java
  • Building ASP.NET Server ControlsFancyLabel.cs

    // Title: Building ASP.NET Server Controls
    //
    // Chapter: 6 - Control Styles
    // File: FancyLabel.cs
    // Written by: Dale Michalk and Rob Cameron
    //
    // Copyright ?2003, Apress L.P.
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.ComponentModel;

    namespace ControlsBookLib.Ch06
    {
       [ToolboxData("<{0}:FancyLabel runat=server></{0}:FancyLabel>"),
       DefaultProperty("Text")]
       public class FancyLabel : WebControl
       {
          public FancyLabel() : base(HtmlTextWriterTag.Span)
          {
          }

          public CursorStyle Cursor
          {
             get
             {
                return ((FancyLabelStyle)ControlStyle).Cursor;
             }
             set
             {
                ((FancyLabelStyle)ControlStyle).Cursor = value;
             }
          }

          public virtual string Text
          {
             get
             {
                object text = ViewState["Text"];
                if (text == null)
                   return string.Empty;
                else
                   return (string) text;
             }
             set
             {
                ViewState["Text"] = value;
             }
          }

          protected override Style CreateControlStyle()
          {
             FancyLabelStyle style = new FancyLabelStyle(ViewState);
             return style;
          }

          override protected void RenderContents(HtmlTextWriter writer)
          {
             writer.Write(Text);
          }
       }
    }
  • 相关阅读:
    luogu1060开心的金明
    luogu1048采药
    uva1025城市里的间谍
    scoi刷题记录(2019/04/07)
    差分及树上差分的正确食用姿势(2019/2/21学习笔记)
    图论技巧(2019/1/28之一)
    考试反思(2019/1/26学习笔记)
    考试反思(2019/1/22)
    「一本通 5.2 例 5」皇宫看守
    「一本通 5.2 例 3」数字转换
  • 原文地址:https://www.cnblogs.com/shihao/p/2498687.html
Copyright © 2011-2022 走看看