Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

64 lignes
1.6 KiB

  1. // This code is distributed under MIT license.
  2. // Copyright (c) 2015 George Mamaladze
  3. // See license.txt or https://mit-license.org/
  4. using System.Runtime.InteropServices;
  5. namespace Gma.System.MouseKeyHook.WinApi
  6. {
  7. /// <summary>
  8. /// The Point structure defines the X- and Y- coordinates of a point.
  9. /// </summary>
  10. /// <remarks>
  11. /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/rectangl_0tiq.asp
  12. /// </remarks>
  13. [StructLayout(LayoutKind.Sequential)]
  14. internal struct Point
  15. {
  16. /// <summary>
  17. /// Specifies the X-coordinate of the point.
  18. /// </summary>
  19. public int X;
  20. /// <summary>
  21. /// Specifies the Y-coordinate of the point.
  22. /// </summary>
  23. public int Y;
  24. public Point(int x, int y)
  25. {
  26. X = x;
  27. Y = y;
  28. }
  29. public static bool operator ==(Point a, Point b)
  30. {
  31. return a.X == b.X && a.Y == b.Y;
  32. }
  33. public static bool operator !=(Point a, Point b)
  34. {
  35. return !(a == b);
  36. }
  37. public bool Equals(Point other)
  38. {
  39. return other.X == X && other.Y == Y;
  40. }
  41. public override bool Equals(object obj)
  42. {
  43. if (ReferenceEquals(null, obj)) return false;
  44. if (obj.GetType() != typeof(Point)) return false;
  45. return Equals((Point) obj);
  46. }
  47. public override int GetHashCode()
  48. {
  49. unchecked
  50. {
  51. return (X * 397) ^ Y;
  52. }
  53. }
  54. }
  55. }