本文整理汇总了C#中System.Windows.Forms.ListView.GetReorderedColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.GetReorderedColumn方法的具体用法?C# ListView.GetReorderedColumn怎么用?C# ListView.GetReorderedColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListView
的用法示例。
在下文中一共展示了ListView.GetReorderedColumn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawListViewHeader
public override void DrawListViewHeader (Graphics dc, Rectangle clip, ListView control)
{
bool details = (control.View == View.Details);
// border is drawn directly in the Paint method
if (details && control.HeaderStyle != ColumnHeaderStyle.None) {
dc.FillRectangle (SystemBrushes.Control,
0, 0, control.TotalWidth, control.Font.Height + 5);
if (control.Columns.Count > 0) {
foreach (ColumnHeader col in control.Columns) {
Rectangle rect = col.Rect;
rect.X -= control.h_marker;
#if NET_2_0
bool owner_draw = false;
if (control.OwnerDraw)
owner_draw = DrawListViewColumnHeaderOwnerDraw (dc, control, col, rect);
if (owner_draw)
continue;
#endif
ListViewDrawColumnHeaderBackground (control, col, dc, rect, clip);
rect.X += 5;
rect.Width -= 10;
if (rect.Width <= 0)
continue;
#if NET_2_0
int image_index;
if (control.SmallImageList == null)
image_index = -1;
else
image_index = col.ImageKey == String.Empty ? col.ImageIndex : control.SmallImageList.Images.IndexOfKey (col.ImageKey);
if (image_index > -1 && image_index < control.SmallImageList.Images.Count) {
int image_width = control.SmallImageList.ImageSize.Width + 5;
int text_width = (int)dc.MeasureString (col.Text, control.Font).Width;
int x_origin = rect.X;
int y_origin = rect.Y + ((rect.Height - control.SmallImageList.ImageSize.Height) / 2);
switch (col.TextAlign) {
case HorizontalAlignment.Left:
break;
case HorizontalAlignment.Right:
x_origin = rect.Right - (text_width + image_width);
break;
case HorizontalAlignment.Center:
x_origin = (rect.Width - (text_width + image_width)) / 2 + rect.X;
break;
}
if (x_origin < rect.X)
x_origin = rect.X;
control.SmallImageList.Draw (dc, new Point (x_origin, y_origin), image_index);
rect.X += image_width;
rect.Width -= image_width;
}
#endif
dc.DrawString (col.Text, control.Font, SystemBrushes.ControlText, rect, col.Format);
}
int right = control.GetReorderedColumn (control.Columns.Count - 1).Rect.Right - control.h_marker;
if (right < control.Right) {
Rectangle rect = control.Columns [0].Rect;
rect.X = right;
rect.Width = control.Right - right;
ListViewDrawUnusedHeaderBackground (control, dc, rect, clip);
}
}
}
}