⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 openerdesigner.cs

📁 一个非常好的Web自定义控件
💻 CS
字号:
using System;
using System.Reflection;

namespace MetaBuilders.WebControls {

	/// <summary>
	/// The designer for the dialog opener controls.
	/// </summary>
	public class OpenerDesigner : System.Web.UI.Design.ControlDesigner {
		
		/// <summary>
		/// Overrides <see cref="System.Web.UI.Design.ControlDesigner.GetDesignTimeHtml"/>.
		/// </summary>
		public override string GetDesignTimeHtml() {
			PropertyInfo textProp = this.Component.GetType().GetProperty("Text");
			Boolean resetToNothing = false;
			if ( textProp != null ) {
				if ( textProp.GetValue(this.Component,null).ToString().Length == 0 ) {
					resetToNothing = true;
					PropertyInfo IDProp = this.Component.GetType().GetProperty("ID");
					String currentID = IDProp.GetValue(this.Component,null) as String;
					if ( currentID != null ) {
						textProp.SetValue(this.Component,"[" + currentID + "]",null);
					} else {
						textProp.SetValue(this.Component,"[Text]",null);
					}
				}
			}

			String result = base.GetDesignTimeHtml();

			if ( resetToNothing ) {
				textProp.SetValue(this.Component,"",null);
			}

			return result;
		}

	}
}

⌨️ 快捷键说明

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