当前位置: 首页>>代码示例>>C#>>正文


C# ColumnHeader.Dispose方法代码示例

本文整理汇总了C#中System.Windows.Forms.ColumnHeader.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# ColumnHeader.Dispose方法的具体用法?C# ColumnHeader.Dispose怎么用?C# ColumnHeader.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ColumnHeader的用法示例。


在下文中一共展示了ColumnHeader.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetColumnHeader

        protected static ColumnHeader GetColumnHeader( string name )
		{
			ColumnHeader ch = new ColumnHeader();
			StringBuilder sb = new StringBuilder();
			sb.AppendFormat( "{0}_COLUMN", name );
			// Part = Name;Text;Width;Align
			// Example = From;From;80;Left
			try
			{
				string[] parts = ResourceManager.GetString( sb.ToString().ToUpper( System.Threading.Thread.CurrentThread.CurrentCulture ),
					"Workshare.Trace.UI.Properties.Resources",
					typeof( BaseView ).Assembly ).Split( ';' );
				if (parts.Length == 5)
				{
					ch.Name = parts[0];
					ch.Text = parts[1];
					int width = 60;
					try
					{
                        width = Int32.Parse(parts[2], System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat);
					}
					catch (FormatException)
					{
						// Assign a default value
					}
					ch.Width = width;
					switch (parts[3])
					{
						case "Left":
							ch.TextAlign = HorizontalAlignment.Left;
							break;
						case "Center":
							ch.TextAlign = HorizontalAlignment.Center;
							break;
						case "Right":
							ch.TextAlign = HorizontalAlignment.Right;
							break;
					}
					ch.Tag = parts[4];
				}
				else
				{
					System.Diagnostics.Trace.WriteLine( "The column definitions was not valid in the resource table - " + name, "BaseView.GetColumnHeader" );
					sb.Remove( 0, sb.Length );
					string msg = ResourceManager.GetString( "COLUMN_INVALID",
						"Workshare.Trace.UI.Properties.Resources",
						typeof( BaseView ).Assembly );
					sb.AppendFormat( msg, name );
					if (ch != null)
						ch.Dispose();
					throw ( new ArgumentException( msg ) );
				}
			}
			catch (NullReferenceException)
			{
				System.Diagnostics.Trace.WriteLine("The column name was not in the resource table - " + name, "BaseView.GetColumnHeader");
				sb.Remove( 0, sb.Length );
				string msg = ResourceManager.GetString( "COLUMN_INVALID",
					"Workshare.Trace.UI.Properties.Resources",
					typeof( BaseView ).Assembly );
				sb.AppendFormat( msg, name );
				throw ( new ArgumentException( msg ) );					
			}
			return ch;
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:65,代码来源:BaseView.cs


注:本文中的System.Windows.Forms.ColumnHeader.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。