NativeMethods.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. 
  2. using System;
  3. using System.Drawing;
  4. using System.Runtime.InteropServices;
  5. namespace Dongke.WinForm.Controls
  6. {
  7. internal class NativeMethods
  8. {
  9. public const int WM_GETMINMAXINFO = 0x0024;
  10. public const int WM_NCHITTEST = 0x0084;
  11. public const int WM_NCACTIVATE = 0x0086;
  12. public const int WS_EX_NOACTIVATE = 0x08000000;
  13. public const int HTTRANSPARENT = -1;
  14. public const int HTLEFT = 10;
  15. public const int HTRIGHT = 11;
  16. public const int HTTOP = 12;
  17. public const int HTTOPLEFT = 13;
  18. public const int HTTOPRIGHT = 14;
  19. public const int HTBOTTOM = 15;
  20. public const int HTBOTTOMLEFT = 16;
  21. public const int HTBOTTOMRIGHT = 17;
  22. [StructLayout(LayoutKind.Sequential)]
  23. public struct MINMAXINFO
  24. {
  25. public Point reserved;
  26. public Size maxSize;
  27. public Point maxPosition;
  28. public Size minTrackSize;
  29. public Size maxTrackSize;
  30. }
  31. public static int HIWORD(int n)
  32. {
  33. return (n >> 16) & 0xffff;
  34. }
  35. public static int HIWORD(IntPtr n)
  36. {
  37. return HIWORD(unchecked((int)(long)n));
  38. }
  39. public static int LOWORD(int n)
  40. {
  41. return n & 0xffff;
  42. }
  43. public static int LOWORD(IntPtr n)
  44. {
  45. return LOWORD(unchecked((int)(long)n));
  46. }
  47. }
  48. }