1: /// <summary>
2: /// Structure définissant un item dans un entête
3: /// <summary>
4: [StructLayout(LayoutKind.Sequential)]
5: public struct HDITEM
6: {
7: public Int32 mask;
8: public Int32 cxy;
9: [MarshalAs(UnmanagedType.LPTStr)]
10: public String pszText;
11: public IntPtr hbm;
12: public Int32 cchTextMax;
13: public Int32 fmt;
14: public Int32 lParam;
15: public Int32 iImage;
16: public Int32 iOrder;
17: };
18:
19: /// <summary>
20: /// Permet d'envoyer un message standard au contrôle
21: /// </summary>
22: [DllImport("USER32.DLL", EntryPoint = "SendMessage")]
23: private static extern IntPtr SendMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam);
24:
25: /// <summary>
26: /// Permet d'envoyer un message au contrôle en lui spécifiant une référence à un item d’entête
27: /// </summary>
28: [DllImport("user32", EntryPoint = "SendMessage")]
29: private static extern IntPtr SendMessageItem(IntPtr Handle, Int32 msg, IntPtr wParam, ref HDITEM lParam);
30:
31: /// <summary>
32: /// Gère le formatage des entêtes
33: /// </summary>
34: private enum HeaderFormatValue : int
35: {
36: HDF_LEFT = 0x0000,
37: HDF_RIGHT = 0x0001,
38: HDF_CENTER = 0x0002,
39: HDF_JUSTIFYMASK = 0x0003,
40: HDF_RTLREADING = 0x0004,
41: HDF_OWNERDRAW = 0x8000,
42: HDF_STRING = 0x4000,
43: HDF_BITMAP = 0x2000,
44: HDF_BITMAP_ON_RIGHT = 0x1000,
45: HDF_IMAGE = 0x0800
46: };
47:
48: /// <summary>
49: /// Gère les items dans les entêtes
50: /// </summary>
51: private enum HeaderItemValue : int
52: {
53: HDI_WIDTH = 0x0001,
54: HDI_HEIGHT = HDI_WIDTH,
55: HDI_TEXT = 0x0002,
56: HDI_FORMAT = 0x0004,
57: HDI_LPARAM = 0x0008,
58: HDI_BITMAP = 0x0010,
59: HDI_IMAGE = 0x0020,
60: HDI_DI_SETITEM = 0x0040,
61: HDI_ORDER = 0x0080,
62: HDI_FILTER = 0x0100
63: };
64:
65: /// <summary>
66: /// Gère les méthodes dans les entêtes
67: /// </summary>
68: private enum HeaderMethodValue : int
69: {
70: HDM_GETHEADER = 0x1000 + 31,
71: HDM_SETITEM = 0x1200 + 4,
72: HDM_SETIMAGELIST = 0x1200 + 8,
73: HDM_GETIMAGELIST = 0x1200 + 9
74: };