RefRECT.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using System.Diagnostics.CodeAnalysis;
  3. using System.Runtime.InteropServices;
  4. namespace Standard;
  5. [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
  6. [StructLayout(LayoutKind.Sequential)]
  7. internal class RefRECT
  8. {
  9. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  10. public RefRECT(int left, int top, int right, int bottom)
  11. {
  12. this._left = left;
  13. this._top = top;
  14. this._right = right;
  15. this._bottom = bottom;
  16. }
  17. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  18. public int Width
  19. {
  20. get
  21. {
  22. return this._right - this._left;
  23. }
  24. }
  25. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  26. public int Height
  27. {
  28. get
  29. {
  30. return this._bottom - this._top;
  31. }
  32. }
  33. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  34. public int Left
  35. {
  36. get
  37. {
  38. return this._left;
  39. }
  40. set
  41. {
  42. this._left = value;
  43. }
  44. }
  45. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  46. public int Right
  47. {
  48. get
  49. {
  50. return this._right;
  51. }
  52. set
  53. {
  54. this._right = value;
  55. }
  56. }
  57. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  58. public int Top
  59. {
  60. get
  61. {
  62. return this._top;
  63. }
  64. set
  65. {
  66. this._top = value;
  67. }
  68. }
  69. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  70. public int Bottom
  71. {
  72. get
  73. {
  74. return this._bottom;
  75. }
  76. set
  77. {
  78. this._bottom = value;
  79. }
  80. }
  81. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
  82. public void Offset(int dx, int dy)
  83. {
  84. this._left += dx;
  85. this._top += dy;
  86. this._right += dx;
  87. this._bottom += dy;
  88. }
  89. private int _left;
  90. private int _top;
  91. private int _right;
  92. private int _bottom;
  93. }