CellEventArgsBase.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 XPTable.Models;
  32. namespace XPTable.Events
  33. {
  34. /// <summary>
  35. /// Base class for classes containing Cell event data
  36. /// </summary>
  37. public class CellEventArgsBase : EventArgs
  38. {
  39. #region Class Data
  40. /// <summary>
  41. /// The Cell that Raised the event
  42. /// </summary>
  43. private Cell source;
  44. /// <summary>
  45. /// The Column index of the Cell
  46. /// </summary>
  47. private int column;
  48. /// <summary>
  49. /// The Row index of the Cell
  50. /// </summary>
  51. private int row;
  52. #endregion
  53. #region Constructor
  54. /// <summary>
  55. /// Initializes a new instance of the CellEventArgs class with
  56. /// the specified Cell source and event type
  57. /// </summary>
  58. /// <param name="source">The Cell that Raised the event</param>
  59. public CellEventArgsBase(Cell source) : this(source, -1, -1)
  60. {
  61. }
  62. /// <summary>
  63. /// Initializes a new instance of the CellEventArgs class with
  64. /// the specified Cell source, column index and row index
  65. /// </summary>
  66. /// <param name="source">The Cell that Raised the event</param>
  67. /// <param name="column">The Column index of the Cell</param>
  68. /// <param name="row">The Row index of the Cell</param>
  69. public CellEventArgsBase(Cell source, int column, int row) : base()
  70. {
  71. this.source = source;
  72. this.column = column;
  73. this.row = row;
  74. }
  75. #endregion
  76. #region Properties
  77. /// <summary>
  78. /// Returns the Cell that Raised the event
  79. /// </summary>
  80. public Cell Cell
  81. {
  82. get
  83. {
  84. return this.source;
  85. }
  86. }
  87. /// <summary>
  88. /// Gets the Column index of the Cell
  89. /// </summary>
  90. public int Column
  91. {
  92. get
  93. {
  94. return this.column;
  95. }
  96. }
  97. /// <summary>
  98. ///
  99. /// </summary>
  100. /// <param name="column"></param>
  101. internal void SetColumn(int column)
  102. {
  103. this.column = column;
  104. }
  105. /// <summary>
  106. /// Gets the Row index of the Cell
  107. /// </summary>
  108. public int Row
  109. {
  110. get
  111. {
  112. return this.row;
  113. }
  114. }
  115. /// <summary>
  116. ///
  117. /// </summary>
  118. /// <param name="row"></param>
  119. internal void SetRow(int row)
  120. {
  121. this.row = row;
  122. }
  123. /// <summary>
  124. /// Gets the position of the Cell
  125. /// </summary>
  126. public CellPos CellPos
  127. {
  128. get
  129. {
  130. return new CellPos(this.Row, this.Column);
  131. }
  132. }
  133. #endregion
  134. }
  135. }