• 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));
            }
        }
    }

  • 相关阅读:
    高精度运算专题1-加法运算(The addition operation)
    大数据除法(Large data division)
    大数据阶乘(The factorial of large data)
    大数据加减(Big data addition and subtraction)
    我凭什么能上北大——贺舒婷
    说说我自己(安徽一考生)-2
    说说我自己(安徽一考生)-1
    一个夏日的早晨(山东济南一考生)
    洛谷-回文质数-过程函数与递归
    洛谷-数字反转(升级版)-简单字符串
  • 原文地址:https://www.cnblogs.com/jinweijie/p/1058291.html
Copyright © 2020-2023  润新知