GripBounds.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:GripBounds.cs
  5. * 2.功能描述:结构类
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2014/09/04 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Drawing;
  12. namespace Dongke.IBOSS.PRD.Basics.BaseControls
  13. {
  14. /// <summary>
  15. /// CodeProject.com "Simple pop-up control" "http://www.codeproject.com/cs/miscctrl/simplepopup.asp".
  16. /// </summary>
  17. internal struct GripBounds
  18. {
  19. private const int GripSize = 6;
  20. private const int CornerGripSize = GripSize << 1;
  21. public GripBounds(Rectangle clientRectangle)
  22. {
  23. this.clientRectangle = clientRectangle;
  24. }
  25. private Rectangle clientRectangle;
  26. public Rectangle ClientRectangle
  27. {
  28. get { return clientRectangle; }
  29. //set { clientRectangle = value; }
  30. }
  31. public Rectangle Bottom
  32. {
  33. get
  34. {
  35. Rectangle rect = ClientRectangle;
  36. rect.Y = rect.Bottom - GripSize + 1;
  37. rect.Height = GripSize;
  38. return rect;
  39. }
  40. }
  41. public Rectangle BottomRight
  42. {
  43. get
  44. {
  45. Rectangle rect = ClientRectangle;
  46. rect.Y = rect.Bottom - CornerGripSize + 1;
  47. rect.Height = CornerGripSize;
  48. rect.X = rect.Width - CornerGripSize + 1;
  49. rect.Width = CornerGripSize;
  50. return rect;
  51. }
  52. }
  53. public Rectangle Top
  54. {
  55. get
  56. {
  57. Rectangle rect = ClientRectangle;
  58. rect.Height = GripSize;
  59. return rect;
  60. }
  61. }
  62. public Rectangle TopRight
  63. {
  64. get
  65. {
  66. Rectangle rect = ClientRectangle;
  67. rect.Height = CornerGripSize;
  68. rect.X = rect.Width - CornerGripSize + 1;
  69. rect.Width = CornerGripSize;
  70. return rect;
  71. }
  72. }
  73. public Rectangle Left
  74. {
  75. get
  76. {
  77. Rectangle rect = ClientRectangle;
  78. rect.Width = GripSize;
  79. return rect;
  80. }
  81. }
  82. public Rectangle BottomLeft
  83. {
  84. get
  85. {
  86. Rectangle rect = ClientRectangle;
  87. rect.Width = CornerGripSize;
  88. rect.Y = rect.Height - CornerGripSize + 1;
  89. rect.Height = CornerGripSize;
  90. return rect;
  91. }
  92. }
  93. public Rectangle Right
  94. {
  95. get
  96. {
  97. Rectangle rect = ClientRectangle;
  98. rect.X = rect.Right - GripSize + 1;
  99. rect.Width = GripSize;
  100. return rect;
  101. }
  102. }
  103. public Rectangle TopLeft
  104. {
  105. get
  106. {
  107. Rectangle rect = ClientRectangle;
  108. rect.Width = CornerGripSize;
  109. rect.Height = CornerGripSize;
  110. return rect;
  111. }
  112. }
  113. }
  114. }