Win32.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace CyberX8_Themes.CustomControls
  8. {
  9. public class Win32
  10. {
  11. [StructLayout(LayoutKind.Sequential)]
  12. public struct POINT
  13. {
  14. public int X;
  15. public int Y;
  16. public POINT(int x, int y)
  17. {
  18. this.X = x;
  19. this.Y = y;
  20. }
  21. }
  22. /// <summary>
  23. /// 带有外边框和标题的windows的样式
  24. /// </summary>
  25. public const long WS_CAPTION = 0X00C0000L;
  26. /// <summary>
  27. /// window的基本样式
  28. /// </summary>
  29. public static int GWL_STYLE = -16;
  30. /// <summary>
  31. /// window的扩展样式
  32. /// </summary>
  33. public static int GWL_EXSTYLE = -20;
  34. public static Int32 WS_EX_LAYERED = 0x00080000;
  35. public static Int32 WS_EX_TRANSPARENT = 0x00000020;
  36. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  37. public static extern bool GetCursorPos(out POINT pt);
  38. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  39. public static extern Int32 GetWindowLong(IntPtr hWnd, Int32 nIndex);
  40. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  41. public static extern Int32 SetWindowLong(IntPtr hWnd, Int32 nIndex, int newVal);
  42. [DllImport("gdi32")]
  43. public static extern int DeleteObject(IntPtr obj);
  44. }
  45. }