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

📄 verticalalignconverter.cs

📁 不错的人事管理系统
💻 CS
字号:
using System;
using System.Globalization;
using System.ComponentModel;

namespace System.Web.UI.WebControls
{
	/// <summary>
	/// Summary description for VerticalAlignConverter.
	/// </summary>
	public class VerticalAlignConverter : EnumConverter
	{
		private static string[] stringValues;

		static VerticalAlignConverter() 
		{
			VerticalAlignConverter.stringValues = new String[4];
			VerticalAlignConverter.stringValues[0] = "NotSet";
			VerticalAlignConverter.stringValues[1] = "Top";
			VerticalAlignConverter.stringValues[2] = "Middle";
			VerticalAlignConverter.stringValues[3] = "Bottom";
		}

		public VerticalAlignConverter() : base(typeof(VerticalAlign)) 
		{
		}

		public virtual bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 
		{
			if (sourceType == typeof(String))
				return true;
			return this.CanConvertFrom(context, sourceType);
		}

		public virtual bool CanConvertTo(ITypeDescriptorContext context, Type sourceType) 
		{
			if (sourceType == typeof(String))
				return true;
			return this.CanConvertTo(context, sourceType);
		}

		public virtual object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) 
		{
			string local0;
			string local1;

			if (value == null)
				return null;
			if (value as String != null) 
			{
				local0 = ((String) value).Trim();
				if (local0.Length == 0)
					return 0;
				//		<{ class ILEngineer::Ops::MSIL::Leave }>;
				if ((local1 = local0) != null) 
				{
					local1 = System.String.IsInterned(local1);
					if (local1 != "NotSet") 
					{
						if (local1 == "Top")
						{
//							goto i2;
						}
						if (local1 == "Middle")
						{
//							goto i3;
						}
						if (local1 == "Bottom")
						{
//							goto i4;
						}
					}
					else 
					{
						return 0;
					i2: return 1;
					i3: return 2;
					i4: return 3;
					}
				}
			}
			return this.ConvertFrom(context, culture, value);
		}

		public virtual object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) 
		{
			if (destinationType == typeof(String) && (Int32) value <= 3)
				return VerticalAlignConverter.stringValues[(Int32) value];
			return this.ConvertTo(context, culture, value, destinationType);
		}

	}
}

⌨️ 快捷键说明

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