zoukankan      html  css  js  c++  java
  • moss2007 webpart custom property sample (2) [a simple one, inherit from .net framework webpart]

    using System;
    using System.Runtime.InteropServices;
    using System.Web.UI;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Serialization;

    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.WebPartPages;

    namespace ColorTextWebpart
    {
        [Guid("a90044c4-45f5-4987-96eb-2728ad38319b")]
        public class ColorTextWebpart : System.Web.UI.WebControls.WebParts.WebPart
        {
            public ColorTextWebpart()
            {
                this.ExportMode = WebPartExportMode.All;
            }

            public enum OutTextColor
            {
                Red, Black, Yellow
            }

            private OutTextColor _textColor = OutTextColor.Black;
            private string _outText = "Hello World";

            [Personalizable]
            [WebBrowsable]
            [WebDisplayName( "OutText" )]
            public string OutText
            {
                get { return _outText; }
                set { _outText = value; }
            }

            [Personalizable]
            [WebBrowsable]
            [WebDisplayName("OutTextColor")]
            public OutTextColor TextColor
            {
                get { return _textColor; }
                set { _textColor = value; }
            }

            protected override void Render(HtmlTextWriter writer)
            {
                // TODO: add custom rendering code here.
                writer.Write(string.Format("<font color='{0}'>{1}</font>", this.TextColor.ToString(), this.OutText));
            }
        }
    }

  • 相关阅读:
    P1604&P1601
    【USACO OPEN 10】hop
    [usaco2008feb_gold]路面修整
    bzoj1016: [JSOI2008]最小生成树计数
    bzoj1015: [JSOI2008]星球大战starwar
    bzoj1014: [JSOI2008]火星人prefix
    [bzoj3223]文艺平衡树
    bzoj3224: Tyvj 1728 普通平衡树
    bzoj1012: [JSOI2008]最大数maxnumber
    P3369 【模板】普通平衡树 (splay 模板)
  • 原文地址:https://www.cnblogs.com/jinweijie/p/1058291.html
Copyright © 2011-2022 走看看