imagemodule.ascx.cs

来自「三层架构的.net源码三层架构的.net源码」· CS 代码 · 共 64 行

CS
64
字号
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace MyStarterKit.Portal.Web
{
	/// <summary>
	///	ImageModule 的摘要说明。
	///	图片模板的用户控件
	/// </summary>
	public class ImageModule : PortalModuleControl
	{
		protected System.Web.UI.WebControls.Image Image1;

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 获取图片地址,大小等设置值
			String imageSrc = (String) Settings["src"];
			String imageHeight = (String) Settings["height"];
			String imageWidth = (String) Settings["width"];

			// 根据设置信息,给出初值
			if ((imageSrc != null) && (imageSrc != "")) 
			{
				Image1.ImageUrl = imageSrc;
			}

			if ((imageWidth != null) && (imageWidth != "")) 
			{
				Image1.Width = Int32.Parse(imageWidth);
			}

			if ((imageHeight != null) && (imageHeight != "")) 
			{
				Image1.Height = Int32.Parse(imageHeight);
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}

⌨️ 快捷键说明

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