本文整理匯總了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;
}