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