App_Code/Controls/ResizedImage.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;

namespace MyWebPagesStarterKit.Controls
{
    [ToolboxData("<{0}:ResizedImage runat=server></{0}:ResizedImage>")]
    public class ResizedImage : Image
    {
        public string SectionId
        {
            get { return (ViewState["SectionId"] == null) ? string.Empty : (string)ViewState["SectionId"]; }
            set { ViewState["SectionId"] = value; }
        }

        public string PageId
        {
            get { return (ViewState["PageId"] == null) ? string.Empty : (string)ViewState["PageId"]; }
            set { ViewState["PageId"] = value; }
        }

        public int MaxWidth
        {
            get { return (ViewState["MaxWidth"] == null) ? 50 : (int)ViewState["MaxWidth"]; }
            set { ViewState["MaxWidth"] = value; }
        }

        public int MaxHeight
        {
            get { return (ViewState["MaxHeight"] == null) ? 50 : (int)ViewState["MaxHeight"]; }
            set { ViewState["MaxHeight"] = value; }
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            GenerateEmptyAlternateText = true;

            if (SectionId != string.Empty)
            {
                ImageUrl = string.Format(
                    "~/ImageHandler.ashx?pg={0}&section={1}&image={2}&height={3}&width={4}",
                    PageId,
                    SectionId,
后面还有 18 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。