您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->MyWebPages51aspx汉化最终版>>App-Code/Controls/ResizedImage.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:MyWebPages51aspx汉化最终版
当前文件:文件类型 MyWebPagesStarterKit/App_Code/Controls/ResizedImage.cs打开代码结构图
普通视图
		            
1//=============================================================================================== 2// 3// (c) Copyright Microsoft Corporation. 4// This source is subject to the Microsoft Permissive License. 5// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 6// All other rights reserved. 7// 8//=============================================================================================== 9 10using System; 11using System.Data; 12using System.Configuration; 13using System.Web; 14using System.Web.Security; 15using System.Web.UI; 16using System.Web.UI.WebControls; 17using System.Web.UI.WebControls.WebParts; 18using System.Web.UI.HtmlControls; 19using System.ComponentModel; 20 21namespace MyWebPagesStarterKit.Controls 22{ 23 [ToolboxData("<{0}:ResizedImage runat=server></{0}:ResizedImage>")] 24 public class ResizedImage : Image 25 { 26 public string SectionId 27 { 28 get { return (ViewState["SectionId"] == null) ? string.Empty : (string)ViewState["SectionId"]; } 29 set { ViewState["SectionId"] = value; } 30 } 31 32 public string PageId 33 { 34 get { return (ViewState["PageId"] == null) ? string.Empty : (string)ViewState["PageId"]; } 35 set { ViewState["PageId"] = value; } 36 } 37 38 public int MaxWidth 39 { 40 get { return (ViewState["MaxWidth"] == null) ? 50 : (int)ViewState["MaxWidth"]; } 41 set { ViewState["MaxWidth"] = value; } 42 } 43 44 public int MaxHeight 45 { 46 get { return (ViewState["MaxHeight"] == null) ? 50 : (int)ViewState["MaxHeight"]; } 47 set { ViewState["MaxHeight"] = value; } 48 } 49 50 protected override void OnPreRender(EventArgs e) 51 { 52 base.OnPreRender(e); 53 GenerateEmptyAlternateText = true; 54 55 if (SectionId != string.Empty) 56 { 57 ImageUrl = string.Format( 58 "~/ImageHandler.ashx?pg={0}&section={1}&image={2}&height={3}&width={4}", 59 PageId, 60 SectionId, 61 HttpUtility.UrlEncode(ImageUrl), 62 MaxHeight, 63 MaxWidth 64 ); 65 } 66 else 67 { 68 ImageUrl = string.Format( 69 "~/ImageHandler.ashx?image={0}&height={1}&width={2}", 70 HttpUtility.UrlEncode(ImageUrl), 71 MaxHeight, 72 MaxWidth 73 ); 74 } 75 76 } 77 } 78}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:MyWebPages51aspx汉化最终版
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号