HeaderPanelNativeMethods.cs

Description du code

HeaderPanelNativeMethods.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. #region Using directives
  2.  
  3. using System;
  4. using System.Windows.Forms;
  5. using System.Drawing;
  6. using System.Diagnostics;
  7. using System.Runtime.InteropServices;
  8. using System.Security.Permissions;
  9. using System.Text;
  10. using System.Threading;
  11.  
  12. #endregion
  13.  
  14. namespace KIS.Controls
  15. {
  16. [System.Security.SuppressUnmanagedCodeSecurity]
  17. [System.Runtime.InteropServices.ComVisible(false)]
  18. internal sealed class NativeMethods
  19. {
  20. private NativeMethods()
  21. { }
  22.  
  23. #region WindowStyle
  24. [Flags]
  25. public enum WindowStyle
  26. {
  27. WS_OVERLAPPED = 0x00000000,
  28. WS_POPUP = -2147483648, //0x80000000,
  29. WS_CHILD = 0x40000000,
  30. WS_MINIMIZE = 0x20000000,
  31. WS_VISIBLE = 0x10000000,
  32. WS_DISABLED = 0x08000000,
  33. WS_CLIPSIBLINGS = 0x04000000,
  34. WS_CLIPCHILDREN = 0x02000000,
  35. WS_MAXIMIZE = 0x01000000,
  36. WS_CAPTION = 0x00C00000,
  37. WS_BORDER = 0x00800000,
  38. WS_DLGFRAME = 0x00400000,
  39. WS_VSCROLL = 0x00200000,
  40. WS_HSCROLL = 0x00100000,
  41. WS_SYSMENU = 0x00080000,
  42. WS_THICKFRAME = 0x00040000,
  43. WS_GROUP = 0x00020000,
  44. WS_TABSTOP = 0x00010000,
  45. WS_MINIMIZEBOX = 0x00020000,
  46. WS_MAXIMIZEBOX = 0x00010000,
  47. WS_TILED = WS_OVERLAPPED,
  48. WS_ICONIC = WS_MINIMIZE,
  49. WS_SIZEBOX = WS_THICKFRAME,
  50. WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
  51. WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
  52. WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX),
  53. WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU),
  54. WS_CHILDWINDOW = (WS_CHILD)
  55. }
  56. #endregion //WindowStyle
  57.  
  58. #region WindowStyleEx
  59. [Flags]
  60. public enum WindowStyleEx
  61. {
  62. WS_EX_DLGMODALFRAME = 0x00000001,
  63. WS_EX_NOPARENTNOTIFY = 0x00000004,
  64. WS_EX_TOPMOST = 0x00000008,
  65. WS_EX_ACCEPTFILES = 0x00000010,
  66. WS_EX_TRANSPARENT = 0x00000020,
  67. WS_EX_MDICHILD = 0x00000040,
  68. WS_EX_TOOLWINDOW = 0x00000080,
  69. WS_EX_WINDOWEDGE = 0x00000100,
  70. WS_EX_CLIENTEDGE = 0x00000200,
  71. WS_EX_CONTEXTHELP = 0x00000400,
  72. WS_EX_RIGHT = 0x00001000,
  73. WS_EX_LEFT = 0x00000000,
  74. WS_EX_RTLREADING = 0x00002000,
  75. WS_EX_LTRREADING = 0x00000000,
  76. WS_EX_LEFTSCROLLBAR = 0x00004000,
  77. WS_EX_RIGHTSCROLLBAR = 0x00000000,
  78. WS_EX_CONTROLPARENT = 0x00010000,
  79. WS_EX_STATICEDGE = 0x00020000,
  80. WS_EX_APPWINDOW = 0x00040000,
  81. WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE),
  82. WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST),
  83. WS_EX_LAYERED = 0x00080000,
  84. WS_EX_NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
  85. WS_EX_LAYOUTRTL = 0x00400000, // Right to left mirroring
  86. WS_EX_COMPOSITED = 0x02000000,
  87. WS_EX_NOACTIVATE = 0x08000000,
  88. }
  89. #endregion //WindowStyleEx
  90.  
  91. #region StaticStyle
  92. [Flags]
  93. public enum StaticStyle
  94. {
  95. SS_ETCHEDHORZ = 0x00000010,
  96. SS_ETCHEDVERT = 0x00000011,
  97. }
  98. #endregion
  99.  
  100. #region WindowMessages
  101. public enum WindowMessages
  102. {
  103. WM_NULL = 0x0000,
  104. WM_CREATE = 0x0001,
  105. WM_DESTROY = 0x0002,
  106. WM_MOVE = 0x0003,
  107. WM_SIZE = 0x0005,
  108. WM_ACTIVATE = 0x0006,
  109. WM_SETFOCUS = 0x0007,
  110. WM_KILLFOCUS = 0x0008,
  111. WM_ENABLE = 0x000A,
  112. WM_SETREDRAW = 0x000B,
  113. WM_SETTEXT = 0x000C,
  114. WM_GETTEXT = 0x000D,
  115. WM_GETTEXTLENGTH = 0x000E,
  116. WM_PAINT = 0x000F,
  117. WM_CLOSE = 0x0010,
  118.  
  119. WM_QUIT = 0x0012,
  120. WM_ERASEBKGND = 0x0014,
  121. WM_SYSCOLORCHANGE = 0x0015,
  122. WM_SHOWWINDOW = 0x0018,
  123.  
  124. WM_ACTIVATEAPP = 0x001C,
  125.  
  126. WM_SETCURSOR = 0x0020,
  127. WM_MOUSEACTIVATE = 0x0021,
  128. WM_GETMINMAXINFO = 0x24,
  129. WM_WINDOWPOSCHANGING = 0x0046,
  130. WM_WINDOWPOSCHANGED = 0x0047,
  131.  
  132. WM_CONTEXTMENU = 0x007B,
  133. WM_STYLECHANGING = 0x007C,
  134. WM_STYLECHANGED = 0x007D,
  135. WM_DISPLAYCHANGE = 0x007E,
  136. WM_GETICON = 0x007F,
  137. WM_SETICON = 0x0080,
  138.  
  139. // non client area
  140. WM_NCCREATE = 0x0081,
  141. WM_NCDESTROY = 0x0082,
  142. WM_NCCALCSIZE = 0x0083,
  143. WM_NCHITTEST = 0x84,
  144. WM_NCPAINT = 0x0085,
  145. WM_NCACTIVATE = 0x0086,
  146.  
  147. WM_GETDLGCODE = 0x0087,
  148.  
  149. WM_SYNCPAINT = 0x0088,
  150.  
  151. // non client mouse
  152. WM_NCMOUSEMOVE = 0x00A0,
  153. WM_NCLBUTTONDOWN = 0x00A1,
  154. WM_NCLBUTTONUP = 0x00A2,
  155. WM_NCLBUTTONDBLCLK = 0x00A3,
  156. WM_NCRBUTTONDOWN = 0x00A4,
  157. WM_NCRBUTTONUP = 0x00A5,
  158. WM_NCRBUTTONDBLCLK = 0x00A6,
  159. WM_NCMBUTTONDOWN = 0x00A7,
  160. WM_NCMBUTTONUP = 0x00A8,
  161. WM_NCMBUTTONDBLCLK = 0x00A9,
  162.  
  163. // keyboard
  164. WM_KEYDOWN = 0x0100,
  165. WM_KEYUP = 0x0101,
  166. WM_CHAR = 0x0102,
  167.  
  168. WM_SYSCOMMAND = 0x0112,
  169.  
  170. // menu
  171. WM_INITMENU = 0x0116,
  172. WM_INITMENUPOPUP = 0x0117,
  173. WM_MENUSELECT = 0x011F,
  174. WM_MENUCHAR = 0x0120,
  175. WM_ENTERIDLE = 0x0121,
  176. WM_MENURBUTTONUP = 0x0122,
  177. WM_MENUDRAG = 0x0123,
  178. WM_MENUGETOBJECT = 0x0124,
  179. WM_UNINITMENUPOPUP = 0x0125,
  180. WM_MENUCOMMAND = 0x0126,
  181.  
  182. WM_CHANGEUISTATE = 0x0127,
  183. WM_UPDATEUISTATE = 0x0128,
  184. WM_QUERYUISTATE = 0x0129,
  185.  
  186. // mouse
  187. WM_MOUSEFIRST = 0x0200,
  188. WM_MOUSEMOVE = 0x0200,
  189. WM_LBUTTONDOWN = 0x0201,
  190. WM_LBUTTONUP = 0x0202,
  191. WM_LBUTTONDBLCLK = 0x0203,
  192. WM_RBUTTONDOWN = 0x0204,
  193. WM_RBUTTONUP = 0x0205,
  194. WM_RBUTTONDBLCLK = 0x0206,
  195. WM_MBUTTONDOWN = 0x0207,
  196. WM_MBUTTONUP = 0x0208,
  197. WM_MBUTTONDBLCLK = 0x0209,
  198. WM_MOUSEWHEEL = 0x020A,
  199. WM_MOUSELAST = 0x020D,
  200.  
  201. WM_PARENTNOTIFY = 0x0210,
  202. WM_ENTERMENULOOP = 0x0211,
  203. WM_EXITMENULOOP = 0x0212,
  204.  
  205. WM_NEXTMENU = 0x0213,
  206. WM_SIZING = 0x0214,
  207. WM_CAPTURECHANGED = 0x0215,
  208. WM_MOVING = 0x0216,
  209.  
  210. WM_ENTERSIZEMOVE = 0x0231,
  211. WM_EXITSIZEMOVE = 0x0232,
  212.  
  213. WM_MOUSELEAVE = 0x02A3,
  214. WM_MOUSEHOVER = 0x02A1,
  215. WM_NCMOUSEHOVER = 0x02A0,
  216. WM_NCMOUSELEAVE = 0x02A2,
  217.  
  218. WM_MDIACTIVATE = 0x0222,
  219. WM_HSCROLL = 0x0114,
  220. WM_VSCROLL = 0x0115,
  221.  
  222. WM_PRINT = 0x0317,
  223. WM_PRINTCLIENT = 0x0318,
  224. }
  225. #endregion //WindowMessages
  226.  
  227. #region SystemCommands
  228.  
  229. public enum SystemCommands
  230. {
  231. SC_SIZE = 0xF000,
  232. SC_MOVE = 0xF010,
  233. SC_MINIMIZE = 0xF020,
  234. SC_MAXIMIZE = 0xF030,
  235. SC_MAXIMIZE2 = 0xF032, // fired from double-click on caption
  236. SC_NEXTWINDOW = 0xF040,
  237. SC_PREVWINDOW = 0xF050,
  238. SC_CLOSE = 0xF060,
  239. SC_VSCROLL = 0xF070,
  240. SC_HSCROLL = 0xF080,
  241. SC_MOUSEMENU = 0xF090,
  242. SC_KEYMENU = 0xF100,
  243. SC_ARRANGE = 0xF110,
  244. SC_RESTORE = 0xF120,
  245. SC_RESTORE2 = 0xF122, // fired from double-click on caption
  246. SC_TASKLIST = 0xF130,
  247. SC_SCREENSAVE = 0xF140,
  248. SC_HOTKEY = 0xF150,
  249.  
  250. SC_DEFAULT = 0xF160,
  251. SC_MONITORPOWER = 0xF170,
  252. SC_CONTEXTHELP = 0xF180,
  253. SC_SEPARATOR = 0xF00F
  254. }
  255.  
  256. #endregion // SystemCommands
  257.  
  258. #region PeekMessageOptions
  259. [Flags]
  260. public enum PeekMessageOptions
  261. {
  262. PM_NOREMOVE = 0x0000,
  263. PM_REMOVE = 0x0001,
  264. PM_NOYIELD = 0x0002
  265. }
  266. #endregion // PeekMessageOptions
  267.  
  268. #region NCHITTEST enum
  269. /// <summary>
  270. /// Location of cursor hot spot returnet in WM_NCHITTEST.
  271. /// </summary>
  272. public enum NCHITTEST
  273. {
  274. /// <summary>
  275. /// On the screen background or on a dividing line between windows
  276. /// (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error).
  277. /// </summary>
  278. HTERROR = (-2),
  279. /// <summary>
  280. /// In a window currently covered by another window in the same thread
  281. /// (the message will be sent to underlying windows in the same thread until one of them returns a code that is not HTTRANSPARENT).
  282. /// </summary>
  283. HTTRANSPARENT = (-1),
  284. /// <summary>
  285. /// On the screen background or on a dividing line between windows.
  286. /// </summary>
  287. HTNOWHERE = 0,
  288. /// <summary>In a client area.</summary>
  289. HTCLIENT = 1,
  290. /// <summary>In a title bar.</summary>
  291. HTCAPTION = 2,
  292. /// <summary>In a window menu or in a Close button in a child window.</summary>
  293. HTSYSMENU = 3,
  294. /// <summary>In a size box (same as HTSIZE).</summary>
  295. HTGROWBOX = 4,
  296. /// <summary>In a menu.</summary>
  297. HTMENU = 5,
  298. /// <summary>In a horizontal scroll bar.</summary>
  299. HTHSCROLL = 6,
  300. /// <summary>In the vertical scroll bar.</summary>
  301. HTVSCROLL = 7,
  302. /// <summary>In a Minimize button.</summary>
  303. HTMINBUTTON = 8,
  304. /// <summary>In a Maximize button.</summary>
  305. HTMAXBUTTON = 9,
  306. /// <summary>In the left border of a resizable window
  307. /// (the user can click the mouse to resize the window horizontally).</summary>
  308. HTLEFT = 10,
  309. /// <summary>
  310. /// In the right border of a resizable window
  311. /// (the user can click the mouse to resize the window horizontally).
  312. /// </summary>
  313. HTRIGHT = 11,
  314. /// <summary>In the upper-horizontal border of a window.</summary>
  315. HTTOP = 12,
  316. /// <summary>In the upper-left corner of a window border.</summary>
  317. HTTOPLEFT = 13,
  318. /// <summary>In the upper-right corner of a window border.</summary>
  319. HTTOPRIGHT = 14,
  320. /// <summary> In the lower-horizontal border of a resizable window
  321. /// (the user can click the mouse to resize the window vertically).</summary>
  322. HTBOTTOM = 15,
  323. /// <summary>In the lower-left corner of a border of a resizable window
  324. /// (the user can click the mouse to resize the window diagonally).</summary>
  325. HTBOTTOMLEFT = 16,
  326. /// <summary> In the lower-right corner of a border of a resizable window
  327. /// (the user can click the mouse to resize the window diagonally).</summary>
  328. HTBOTTOMRIGHT = 17,
  329. /// <summary>In the border of a window that does not have a sizing border.</summary>
  330. HTBORDER = 18,
  331.  
  332. HTOBJECT = 19,
  333. /// <summary>In a Close button.</summary>
  334. HTCLOSE = 20,
  335. /// <summary>In a Help button.</summary>
  336. HTHELP = 21,
  337. }
  338.  
  339. #endregion //NCHITTEST
  340.  
  341. #region DCX enum
  342. [Flags()]
  343. internal enum DCX
  344. {
  345. DCX_CACHE = 0x2,
  346. DCX_CLIPCHILDREN = 0x8,
  347. DCX_CLIPSIBLINGS = 0x10,
  348. DCX_EXCLUDERGN = 0x40,
  349. DCX_EXCLUDEUPDATE = 0x100,
  350. DCX_INTERSECTRGN = 0x80,
  351. DCX_INTERSECTUPDATE = 0x200,
  352. DCX_LOCKWINDOWUPDATE = 0x400,
  353. DCX_NORECOMPUTE = 0x100000,
  354. DCX_NORESETATTRS = 0x4,
  355. DCX_PARENTCLIP = 0x20,
  356. DCX_VALIDATE = 0x200000,
  357. DCX_WINDOW = 0x1,
  358. }
  359. #endregion //DCX
  360.  
  361. #region ShowWindow flags
  362. [Flags]
  363. public enum ShowWindowOptions
  364. {
  365. SW_HIDE = 0,
  366. SW_SHOWNOACTIVATE = 4,
  367. }
  368.  
  369. #endregion
  370.  
  371. #region SetWindowPosition flags
  372. [Flags]
  373. public enum SetWindowPosOptions
  374. {
  375. SWP_NOSIZE = 0x0001,
  376. SWP_NOMOVE = 0x0002,
  377. SWP_NOZORDER = 0x0004,
  378. SWP_NOACTIVATE = 0x0010,
  379. SWP_FRAMECHANGED = 0x0020, /* The frame changed: send WM_NCCALCSIZE */
  380. SWP_SHOWWINDOW = 0x0040,
  381. SWP_HIDEWINDOW = 0x0080,
  382. SWP_NOCOPYBITS = 0x0100,
  383. SWP_NOOWNERZORDER = 0x0200, /* Don't do owner Z ordering */
  384. SWP_NOSENDCHANGING = 0x0400 /* Don't send WM_WINDOWPOSCHANGING */
  385. }
  386. #endregion
  387.  
  388. #region RedrawWindow flags
  389. [Flags]
  390. public enum RedrawWindowOptions
  391. {
  392. RDW_INVALIDATE = 0x0001,
  393. RDW_INTERNALPAINT = 0x0002,
  394. RDW_ERASE = 0x0004,
  395. RDW_VALIDATE = 0x0008,
  396. RDW_NOINTERNALPAINT = 0x0010,
  397. RDW_NOERASE = 0x0020,
  398. RDW_NOCHILDREN = 0x0040,
  399. RDW_ALLCHILDREN = 0x0080,
  400. RDW_UPDATENOW = 0x0100,
  401. RDW_ERASENOW = 0x0200,
  402. RDW_FRAME = 0x0400,
  403. RDW_NOFRAME = 0x0800
  404. }
  405. #endregion
  406.  
  407. #region RECT structure
  408.  
  409. [StructLayout(LayoutKind.Sequential)]
  410. internal struct RECT
  411. {
  412. public int left;
  413. public int top;
  414. public int right;
  415. public int bottom;
  416.  
  417. public RECT(int left, int top, int right, int bottom)
  418. {
  419. this.left = left;
  420. this.top = top;
  421. this.right = right;
  422. this.bottom = bottom;
  423. }
  424.  
  425. public Rectangle Rect { get { return new Rectangle(this.left, this.top, this.right - this.left, this.bottom - this.top); } }
  426.  
  427. public static RECT FromXYWH(int x, int y, int width, int height)
  428. {
  429. return new RECT(x,
  430. y,
  431. x + width,
  432. y + height);
  433. }
  434.  
  435. public static RECT FromRectangle(Rectangle rect)
  436. {
  437. return new RECT(rect.Left,
  438. rect.Top,
  439. rect.Right,
  440. rect.Bottom);
  441. }
  442. }
  443.  
  444. #endregion RECT structure
  445.  
  446. #region WINDOWPOS
  447. [StructLayout(LayoutKind.Sequential)]
  448. internal struct WINDOWPOS
  449. {
  450. internal IntPtr hwnd;
  451. internal IntPtr hWndInsertAfter;
  452. internal int x;
  453. internal int y;
  454. internal int cx;
  455. internal int cy;
  456. internal uint flags;
  457. }
  458. #endregion //WINDOWPOS
  459.  
  460. #region NCCALCSIZE_PARAMS
  461. //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowstructures/nccalcsize_params.asp
  462. [StructLayout(LayoutKind.Sequential)]
  463. public struct NCCALCSIZE_PARAMS
  464. {
  465. /// <summary>
  466. /// Contains the new coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates.
  467. /// </summary>
  468. public RECT rectProposed;
  469. /// <summary>
  470. /// Contains the coordinates of the window before it was moved or resized.
  471. /// </summary>
  472. public RECT rectBeforeMove;
  473. /// <summary>
  474. /// Contains the coordinates of the window's client area before the window was moved or resized.
  475. /// </summary>
  476. public RECT rectClientBeforeMove;
  477. /// <summary>
  478. /// Pointer to a WINDOWPOS structure that contains the size and position values specified in the operation that moved or resized the window.
  479. /// </summary>
  480. public WINDOWPOS lpPos;
  481. }
  482. #endregion //NCCALCSIZE_PARAMS
  483.  
  484. #region TRACKMOUSEEVENT structure
  485.  
  486. [StructLayout(LayoutKind.Sequential)]
  487. public class TRACKMOUSEEVENT
  488. {
  489. public TRACKMOUSEEVENT()
  490. {
  491. this.cbSize = Marshal.SizeOf(typeof(NativeMethods.TRACKMOUSEEVENT));
  492. this.dwHoverTime = 100;
  493. }
  494.  
  495. public int cbSize;
  496. public int dwFlags;
  497. public IntPtr hwndTrack;
  498. public int dwHoverTime;
  499. }
  500.  
  501. #endregion
  502.  
  503. #region TrackMouseEventFalgs enum
  504.  
  505. [Flags]
  506. public enum TrackMouseEventFalgs
  507. {
  508. TME_HOVER = 1,
  509. TME_LEAVE = 2,
  510. TME_NONCLIENT = 0x00000010
  511. }
  512.  
  513. #endregion
  514.  
  515. public enum TernaryRasterOperations
  516. {
  517. SRCCOPY = 0x00CC0020, /* dest = source*/
  518. SRCPAINT = 0x00EE0086, /* dest = source OR dest*/
  519. SRCAND = 0x008800C6, /* dest = source AND dest*/
  520. SRCINVERT = 0x00660046, /* dest = source XOR dest*/
  521. SRCERASE = 0x00440328, /* dest = source AND (NOT dest )*/
  522. NOTSRCCOPY = 0x00330008, /* dest = (NOT source)*/
  523. NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
  524. MERGECOPY = 0x00C000CA, /* dest = (source AND pattern)*/
  525. MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest*/
  526. PATCOPY = 0x00F00021, /* dest = pattern*/
  527. PATPAINT = 0x00FB0A09, /* dest = DPSnoo*/
  528. PATINVERT = 0x005A0049, /* dest = pattern XOR dest*/
  529. DSTINVERT = 0x00550009, /* dest = (NOT dest)*/
  530. BLACKNESS = 0x00000042, /* dest = BLACK*/
  531. WHITENESS = 0x00FF0062, /* dest = WHITE*/
  532. };
  533.  
  534. public static readonly IntPtr TRUE = new IntPtr(1);
  535. public static readonly IntPtr FALSE = new IntPtr(0);
  536.  
  537. public static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
  538.  
  539. [DllImport("user32.dll")]
  540. public static extern IntPtr GetDesktopWindow();
  541.  
  542. [DllImport("user32.dll")]
  543. public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hParent);
  544.  
  545. [DllImport("user32.dll")]
  546. public static extern Int32 SetWindowLong(IntPtr hWnd, Int32 Offset, Int32 newLong);
  547.  
  548. [DllImport("user32.dll")]
  549. public static extern Int32 GetWindowLong(IntPtr hWnd, Int32 Offset);
  550.  
  551. [DllImport("user32.dll")]
  552. public static extern Int32 ShowWindow(IntPtr hWnd, Int32 dwFlags);
  553.  
  554. [DllImport("user32.dll")]
  555. public static extern Int32 SetWindowPos(IntPtr hWnd, IntPtr hWndAfter, Int32 x, Int32 y, Int32 cx, Int32 cy, UInt32 uFlags);
  556.  
  557. [DllImport("user32.dll")]
  558. public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
  559.  
  560. [DllImport("user32.dll")]
  561. public static extern bool PeekMessage(ref Message msg, IntPtr hwnd, int msgMin, int msgMax, int remove);
  562.  
  563. [DllImport("user32.dll")]
  564. public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
  565. int x, int y, int cx, int cy, int flags);
  566.  
  567. [DllImport("user32.dll")]
  568. public static extern bool RedrawWindow(IntPtr hWnd, IntPtr rectUpdate, IntPtr hrgnUpdate, uint flags);
  569.  
  570. [DllImport("user32.dll")]
  571. public static extern IntPtr GetDCEx(IntPtr hwnd, IntPtr hrgnclip, uint fdwOptions);
  572.  
  573. [DllImport("user32.dll")]
  574. public static extern IntPtr GetWindowDC(IntPtr hWnd);
  575.  
  576. [DllImport("user32.dll")]
  577. public static extern int ReleaseDC(IntPtr hwnd, IntPtr hDC);
  578.  
  579. [DllImport("user32.dll")]
  580. public static extern int GetWindowRect(IntPtr hwnd, ref RECT lpRect);
  581.  
  582. [DllImport("user32.dll")]
  583. public static extern void DisableProcessWindowsGhosting();
  584.  
  585. [DllImport("user32.dll")]
  586. public static extern short GetAsyncKeyState(int nVirtKey);
  587.  
  588. public const int VK_LBUTTON = 0x01;
  589. public const int VK_RBUTTON = 0x02;
  590.  
  591. [DllImport("uxtheme.dll")]
  592. public static extern int SetWindowTheme(IntPtr hwnd, String pszSubAppName,
  593. String pszSubIdList);
  594.  
  595. [DllImport("comctl32.dll", SetLastError = true)]
  596. private static extern bool _TrackMouseEvent(TRACKMOUSEEVENT tme);
  597.  
  598. public static bool TrackMouseEvent(TRACKMOUSEEVENT tme)
  599. {
  600. return _TrackMouseEvent(tme);
  601. }
  602.  
  603. public static int GetLastError()
  604. {
  605. return System.Runtime.InteropServices.Marshal.GetLastWin32Error();
  606. }
  607.  
  608. [DllImport("gdi32.dll")]
  609. public static extern IntPtr CreateCompatibleDC(IntPtr hDC);
  610.  
  611. [DllImport("gdi32.dll")]
  612. public static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int nWidth, int nHeight);
  613.  
  614. [DllImport("gdi32.dll")]
  615. public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
  616.  
  617. [DllImport("gdi32.dll")]
  618. public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, int nWidth,
  619. int nHeight, IntPtr hObjSource, int nXSrc, int nYSrc, TernaryRasterOperations dwRop);
  620.  
  621. [DllImport("gdi32.dll")]
  622. public static extern bool DeleteObject(IntPtr hObject);
  623.  
  624. [DllImport("gdi32.dll")]
  625. public static extern bool DeleteDC(IntPtr hDC);
  626.  
  627. #region AppBarInfo
  628.  
  629. [StructLayout(LayoutKind.Sequential)]
  630. public struct APPBARDATA
  631. {
  632. public System.UInt32 cbSize;
  633. public System.IntPtr hWnd;
  634. public System.UInt32 uCallbackMessage;
  635. public System.UInt32 uEdge;
  636. public RECT rc;
  637. public System.Int32 lParam;
  638. }
  639.  
  640. [DllImport("user32.dll")]
  641. public static extern System.IntPtr FindWindow(String lpClassName, String lpWindowName);
  642.  
  643. [DllImport("shell32.dll")]
  644. public static extern System.UInt32 SHAppBarMessage(System.UInt32 dwMessage, ref APPBARDATA data);
  645.  
  646. [DllImport("user32.dll")]
  647. public static extern System.Int32 SystemParametersInfo(System.UInt32 uiAction, System.UInt32 uiParam,
  648. System.IntPtr pvParam, System.UInt32 fWinIni);
  649.  
  650.  
  651. public class AppBarInfo
  652. {
  653. private APPBARDATA m_data;
  654.  
  655. // Appbar messages
  656. private const int ABM_NEW = 0x00000000;
  657. private const int ABM_REMOVE = 0x00000001;
  658. private const int ABM_QUERYPOS = 0x00000002;
  659. private const int ABM_SETPOS = 0x00000003;
  660. private const int ABM_GETSTATE = 0x00000004;
  661. private const int ABM_GETTASKBARPOS = 0x00000005;
  662. private const int ABM_ACTIVATE = 0x00000006; // lParam == TRUE/FALSE means activate/deactivate
  663. private const int ABM_GETAUTOHIDEBAR = 0x00000007;
  664. private const int ABM_SETAUTOHIDEBAR = 0x00000008;
  665.  
  666. // Appbar edge constants
  667. private const int ABE_LEFT = 0;
  668. private const int ABE_TOP = 1;
  669. private const int ABE_RIGHT = 2;
  670. private const int ABE_BOTTOM = 3;
  671.  
  672. // SystemParametersInfo constants
  673. private const System.UInt32 SPI_GETWORKAREA = 0x0030;
  674.  
  675. public enum ScreenEdge
  676. {
  677. Undefined = -1,
  678. Left = ABE_LEFT,
  679. Top = ABE_TOP,
  680. Right = ABE_RIGHT,
  681. Bottom = ABE_BOTTOM
  682. }
  683.  
  684. public ScreenEdge Edge
  685. {
  686. get { return (ScreenEdge)m_data.uEdge; }
  687. }
  688.  
  689. public Rectangle WorkArea
  690. {
  691. get
  692. {
  693. Int32 bResult = 0;
  694. RECT rc = new RECT();
  695. IntPtr rawRect = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(rc));
  696. bResult = SystemParametersInfo(SPI_GETWORKAREA, 0, rawRect, 0);
  697. rc = (RECT)System.Runtime.InteropServices.Marshal.PtrToStructure(rawRect, rc.GetType());
  698.  
  699. if (bResult == 1)
  700. {
  701. System.Runtime.InteropServices.Marshal.FreeHGlobal(rawRect);
  702. return new Rectangle(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
  703. }
  704.  
  705. return new Rectangle(0, 0, 0, 0);
  706. }
  707. }
  708.  
  709. public void GetPosition(string strClassName, string strWindowName)
  710. {
  711. m_data = new APPBARDATA();
  712. m_data.cbSize = (UInt32)System.Runtime.InteropServices.Marshal.SizeOf(m_data.GetType());
  713.  
  714. IntPtr hWnd = FindWindow(strClassName, strWindowName);
  715.  
  716. if (hWnd != IntPtr.Zero)
  717. {
  718. UInt32 uResult = SHAppBarMessage(ABM_GETTASKBARPOS, ref m_data);
  719.  
  720. if (uResult == 1)
  721. {
  722. }
  723. else
  724. {
  725. throw new Exception("Failed to communicate with the given AppBar");
  726. }
  727. }
  728. else
  729. {
  730. throw new Exception("Failed to find an AppBar that matched the given criteria");
  731. }
  732. }
  733.  
  734. public void GetSystemTaskBarPosition()
  735. {
  736. GetPosition("Shell_TrayWnd", null);
  737. }
  738. }
  739.  
  740. #endregion
  741.  
  742.  
  743. }
  744. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/controls/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1732238900 22/11/2024 02:28:20
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/controls/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csToolBarHomeControl.Designer.cs7.41 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csWizardUserControl.Designer.cs6.79 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csHeaderPanel.Designer.cs1.19 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csDGVLayoutOptionsControl.cs7.55 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csXPGroupBox.cs15.83 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csWizardXpUserControl.Designer.cs7.85 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csToolBarHomeControl.cs2.32 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csVersionControl.Designer.cs4.09 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csWizardUserControl.cs2.01 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .resx|.resxWizardXpUserControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csBrolBoxUserControl.Designer.cs5.92 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxChartControl.resx6.58 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csHeaderPanel.cs35.93 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csIWizardUC.cs2.35 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxAboutUserControl.resx5.68 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csTextBoxDragDrop.cs8.59 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csSystemInfoControl.cs5.46 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxXPGroupBox.resx17.7 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csHeaderPanelNativeMethods.cs21.09 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csToolBarManagerControl.cs6.99 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csTextBoxDragDrop.Designer.cs1.11 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxSystemInfoControl.resx6.22 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csSystemInfoControl.Designer.cs4.79 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxHeaderPanel.resx5.85 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csScrollablePictureBoxUserControl.cs5.55 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csBrolBoxUserControl.cs4.7 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxDGVLayoutOptionsControl.resx5.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxWizardUserControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csUpdateControl.cs7.55 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIconList.cs2.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csVersionControl.cs463 octets31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxBrolBoxUserControl.resx5.68 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csAboutUserControl.cs6.75 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxToolBarManagerControl.resx5.88 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csToolBarManagerControl.Designer.cs10.66 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIToolBarControl.cs1.07 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csWizardXpUserControl.cs8.11 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csImageCombo.cs15.49 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csAboutUserControl.Designer.cs12.31 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxScrollablePictureBoxUserControl.resx5.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csScrollablePictureBoxUserControl.Designer.cs5.64 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxVersionControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csChartControl.Designer.cs18.45 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csUpdateControl.Designer.cs3.92 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxUpdateControl.resx5.68 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csChartControl.cs15.11 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csDGVLayoutOptionsControl.Designer.cs17.39 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csToolStrip.cs1.06 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIconList.Designer.cs1.1 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxToolBarHomeControl.resx48.51 Ko31/10/2018 18:33:12-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Version en cache

22/11/2024 02:28:20 Cette version de la page est en cache (à la date du 22/11/2024 02:28:20) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.

Document créé le 16/10/2009, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/cs-broldev-source-rf-view/controls/HeaderPanelNativeMethods.cs.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.