本文整理匯總了C#中System.Windows.Forms.ColumnHeader.SetListView方法的典型用法代碼示例。如果您正苦於以下問題:C# ColumnHeader.SetListView方法的具體用法?C# ColumnHeader.SetListView怎麽用?C# ColumnHeader.SetListView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.ColumnHeader
的用法示例。
在下文中一共展示了ColumnHeader.SetListView方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Remove
public virtual void Remove (ColumnHeader column)
{
if (!Contains (column))
return;
list.Remove (column);
column.SetListView (null);
int rem_display_index = column.InternalDisplayIndex;
int [] display_indices = new int [list.Count];
for (int i = 0; i < display_indices.Length; i++) {
ColumnHeader col = (ColumnHeader) list [i];
int display_index = col.InternalDisplayIndex;
if (display_index < rem_display_index) {
display_indices [i] = display_index;
} else {
display_indices [i] = (display_index - 1);
}
}
column.InternalDisplayIndex = -1;
owner.ReorderColumns (display_indices, true);
//UIA Framework event: Item Removed
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, column));
}
示例2: AddColumn
internal void AddColumn (ColumnHeader newCol, int index, bool redraw)
{
int column_count = Columns.Count;
newCol.SetListView (this);
int [] display_indices = new int [column_count];
for (int i = 0; i < column_count; i++) {
ColumnHeader col = Columns [i];
if (i == index) {
display_indices [i] = index;
} else {
int display_index = col.InternalDisplayIndex;
if (display_index < index) {
display_indices [i] = display_index;
} else {
display_indices [i] = (display_index + 1);
}
}
}
ReorderColumns (display_indices, redraw);
Invalidate ();
}