本文整理汇总了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;
}