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

📄 dialogcontrolconverter.cs

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

namespace MetaBuilders.WebControls {

	/// <summary>
	/// Gives better designer support for the DialogToOpen properties of DialogOpenButton and DialogOpenLink.
	/// </summary>
	public class DialogControlConverter : StringConverter {
		
		#region Make It A ComboBox
		/// <summary>
		/// Makes the converter a combobox
		/// </summary>
		public override bool GetStandardValuesSupported(ITypeDescriptorContext context) {
			return true;
		}
		/// <summary>
		/// Makes the converter a combobox
		/// </summary>
		public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) {
			return false;
		}
		#endregion
		
		#region Display Control IDs In List

		/// <summary>
		/// Gets a list of all the controls that derive from DialogWindowBase.
		/// </summary>
		public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
			if ((context == null) || (context.Container == null)) {
				return null; 
			}
			Object[] serverControls = this.GetControls(context.Container);
			if (serverControls != null) {
				return new StandardValuesCollection(serverControls); 
			}
			return null; 
		}
		private object[] GetControls(IContainer container) {
			ArrayList availableControls = new ArrayList();
			foreach( IComponent component in container.Components ) {
				Control serverControl = component as Control;
				if ( serverControl != null && 
					!(serverControl is Page) && 
					serverControl.ID != null && 
					serverControl.ID.Length != 0  && 
					IncludeControl(serverControl) 
					) {
					availableControls.Add(serverControl.ID);
				}
			}
			availableControls.Sort(Comparer.Default);
			return availableControls.ToArray(); 
		}
		#endregion
		
		private Boolean IncludeControl( Control serverControl ) {
			return serverControl is DialogWindowBase;
		}
	}
}

⌨️ 快捷键说明

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