HeaderMouseEventArgs.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. //#########################################################################################
  2. //★★★★★★★ http://www.cnpopsoft.com [华普软件] ★★★★★★★
  3. //★★★★★★★ 华普软件 - VB & C#.NET 专业论文与源码荟萃! ★★★★★★★
  4. //#########################################################################################
  5. /*
  6. * Copyright ?2005, Mathew Hall
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without modification,
  10. * are permitted provided that the following conditions are met:
  11. *
  12. * - Redistributions of source code must retain the above copyright notice,
  13. * this list of conditions and the following disclaimer.
  14. *
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  22. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  23. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  24. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  25. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  26. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  28. * OF SUCH DAMAGE.
  29. */
  30. using System;
  31. using System.Drawing;
  32. using System.Windows.Forms;
  33. using XPTable.Models;
  34. namespace XPTable.Events
  35. {
  36. #region Delegates
  37. /// <summary>
  38. /// Represents the method that will handle the HeaderMouseEnter, HeaderMouseLeave,
  39. /// HeaderMouseDown, HeaderMouseUp, HeaderMouseMove, HeaderClick and HeaderDoubleClick
  40. /// events of a Table
  41. /// </summary>
  42. public delegate void HeaderMouseEventHandler(object sender, HeaderMouseEventArgs e);
  43. #endregion
  44. #region HeaderMouseEventArgs
  45. /// <summary>
  46. /// Provides data for the HeaderMouseEnter, HeaderMouseLeave, HeaderMouseDown,
  47. /// HeaderMouseUp, HeaderMouseMove, HeaderClick and HeaderDoubleClick events of a Table
  48. /// </summary>
  49. public class HeaderMouseEventArgs : MouseEventArgs
  50. {
  51. #region Class Data
  52. /// <summary>
  53. /// The Column that raised the event
  54. /// </summary>
  55. private Column column;
  56. /// <summary>
  57. /// The Table the Column belongs to
  58. /// </summary>
  59. private Table table;
  60. /// <summary>
  61. /// The index of the Column
  62. /// </summary>
  63. private int index;
  64. /// <summary>
  65. /// The column header's bounding rectangle
  66. /// </summary>
  67. private Rectangle headerRect;
  68. #endregion
  69. #region Constructor
  70. /// <summary>
  71. /// Initializes a new instance of the HeaderMouseEventArgs class with
  72. /// the specified source Column, Table, column index and column header bounds
  73. /// </summary>
  74. /// <param name="column">The Column that Raised the event</param>
  75. /// <param name="table">The Table the Column belongs to</param>
  76. /// <param name="index">The index of the Column</param>
  77. /// <param name="headerRect">The column header's bounding rectangle</param>
  78. public HeaderMouseEventArgs(Column column, Table table, int index, Rectangle headerRect) : base(MouseButtons.None, 0, -1, -1, 0)
  79. {
  80. this.column = column;
  81. this.table = table;
  82. this.index = index;
  83. this.headerRect = headerRect;
  84. }
  85. /// <summary>
  86. /// Initializes a new instance of the HeaderMouseEventArgs class with
  87. /// the specified source Column, Table, column index, column header bounds
  88. /// and MouseEventArgs
  89. /// </summary>
  90. /// <param name="column">The Column that Raised the event</param>
  91. /// <param name="table">The Table the Column belongs to</param>
  92. /// <param name="index">The index of the Column</param>
  93. /// <param name="headerRect">The column header's bounding rectangle</param>
  94. /// <param name="mea">The MouseEventArgs that contains data about the
  95. /// mouse event</param>
  96. public HeaderMouseEventArgs(Column column, Table table, int index, Rectangle headerRect, MouseEventArgs mea) : base(mea.Button, mea.Clicks, mea.X, mea.Y, mea.Delta)
  97. {
  98. this.column = column;
  99. this.table = table;
  100. this.index = index;
  101. this.headerRect = headerRect;
  102. }
  103. #endregion
  104. #region Properties
  105. /// <summary>
  106. /// Gets the Column that Raised the event
  107. /// </summary>
  108. public Column Column
  109. {
  110. get
  111. {
  112. return this.column;
  113. }
  114. }
  115. /// <summary>
  116. /// Gets the Table the Cell belongs to
  117. /// </summary>
  118. public Table Table
  119. {
  120. get
  121. {
  122. return this.table;
  123. }
  124. }
  125. /// <summary>
  126. /// Gets the index of the Column
  127. /// </summary>
  128. public int Index
  129. {
  130. get
  131. {
  132. return this.index;
  133. }
  134. }
  135. /// <summary>
  136. /// Gets the column header's bounding rectangle
  137. /// </summary>
  138. public Rectangle HeaderRect
  139. {
  140. get
  141. {
  142. return this.headerRect;
  143. }
  144. }
  145. #endregion
  146. }
  147. #endregion
  148. }