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);
          }
       }
    }
  • 相关阅读:
    Android学习笔记——Menu(三)
    Android学习笔记——Menu(二)
    Android学习笔记——Menu(一)
    Python学习笔记(三)——迭代
    Python学习笔记(二)——高级特性
    Python学习笔记(一)——基本知识点
    Java中遍历Map的常用方法
    比较Java中几个常用集合添加元素的效率
    Java计算两个程序运行时间
    Java中的并发编程集合使用
  • 原文地址:https://www.cnblogs.com/shihao/p/2498687.html
Copyright © 2011-2022 走看看