logo.cs

来自「C#邮件代码库,用于邮件发送」· CS 代码 · 共 52 行

CS
52
字号
namespace ASPNET.StarterKit.Communities {
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
	using System.ComponentModel;


    //*********************************************************************
    //
    // Logo Class
    //
    // Represents the community logo.
    //
    //*********************************************************************

	[Designer(typeof(ASPNET.StarterKit.Communities.CommunityDesigner))]  
    public class Logo : WebControl {

        SectionInfo objSectionInfo;



        //*********************************************************************
        //
        // RenderContents Method
        //
        // Display the logo image.
        //
        //*********************************************************************

        protected override void RenderContents(HtmlTextWriter writer) {
            // Get the SectionInfo
            objSectionInfo = (SectionInfo)Context.Items["SectionInfo"];
        
            // Do we have a logo image?
            if (objSectionInfo.Logo.Trim() != String.Empty)
                RenderLogoImage(writer);
         }
        
        
        void RenderLogoImage(HtmlTextWriter writer) {
            writer.AddAttribute(HtmlTextWriterAttribute.Href, CommunityGlobals.ResolveBase("default.aspx"));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.Write(String.Format("<img src=\"{0}\" border=\"0\" />", objSectionInfo.Logo));
            writer.RenderEndTag();
        }

    

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?