2 // System.Windows.Forms.DataGridCell.cs
5 // Dennis Hayes (dennish@raytek.com)
7 // (C) 2002 Ximian, Inc. http://www.ximian.com
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 namespace System
.Windows
.Forms
{
35 public struct DataGridCell
{
37 private int rownumber
;
38 private int columnnumber
;
40 // -----------------------
42 // -----------------------
52 public DataGridCell (int r
, int c
)
58 // -----------------------
59 // Public Shared Members
60 // -----------------------
63 /// Compares two DataGridCell objects. The return value is
64 /// based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
67 public static bool operator == (DataGridCell dgc_a
,
70 return ((dgc_a
.rownumber
== dgc_b
.rownumber
) &&
71 (dgc_a
.columnnumber
== dgc_b
.columnnumber
));
75 /// Inequality Operator
79 /// Compares two DataGridCell objects. The return value is
80 /// based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
82 public static bool operator != (DataGridCell dgc_a
,
84 return ((dgc_a
.rownumber
!= dgc_b
.rownumber
) ||
85 (dgc_a
.columnnumber
!= dgc_b
.columnnumber
));
88 // -----------------------
89 // Public Instance Members
90 // -----------------------
93 public int RowNumber
{
102 public int ColumnNumber
{
107 columnnumber
= value;
116 /// Checks equivalence of this DataGridCell and another object.
119 public override bool Equals (object o
)
121 if (!(o
is DataGridCell
))
124 return (this == (DataGridCell
) o
);
128 /// GetHashCode Method
132 /// Calculates a hashing value.
135 public override int GetHashCode ()
137 return (int)( rownumber ^ columnnumber
);
145 /// Formats the DataGridCell as a string.
148 public override string ToString ()
150 return String
.Format ("[{0},{1}]", rownumber
, columnnumber
);