-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathListViewEx.cs
61 lines (52 loc) · 1.39 KB
/
ListViewEx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Windows.Forms;
namespace SpecialFNs
{
class ListViewEx : System.Windows.Forms.ListView
{
public ListViewEx()
{
//Activate double buffering
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
}
class ColumnHideInfo
{
public Int32 RealWidth;
}
// summary:
// Hides a column, saving its real with to TAG field
public static void HideColumn(ColumnHeader a_Column)
{
if (0 == a_Column.Width)
return;
ColumnHideInfo hideInfo = new ColumnHideInfo();
a_Column.Tag = hideInfo;
hideInfo.RealWidth = a_Column.Width;
a_Column.Width = 0;
}
// summary:
// Shows a column previously hidden with HideColumn()
public static void UnhideColumn(ColumnHeader a_Column)
{
if (0 != a_Column.Width)
return;
ColumnHideInfo hideInfo = (ColumnHideInfo)a_Column.Tag;
a_Column.Width = hideInfo.RealWidth;
}
// summary:
// Gets a column's width, even if it's hidden with HideColumn()
public static UInt32 GetHideableColumnWidth(ColumnHeader a_Column)
{
if (0 != a_Column.Width)
return (UInt32)a_Column.Width;
ColumnHideInfo hideInfo = (ColumnHideInfo)a_Column.Tag;
return (UInt32)hideInfo.RealWidth;
}
// summary:
// Checks whether column is hidden
public static Boolean IsColumnVisible(ColumnHeader a_Column)
{
return (0 != a_Column.Width);
}
}
}