2007-06-13 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DataGridViewCell.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
21 //
22 // Author:
23 //      Pedro Martínez Juliá <pedromj@gmail.com>
24 //
25
26
27 #if NET_2_0
28
29 using System;
30 using System.Drawing;
31 using System.ComponentModel;
32 using System.Runtime.InteropServices;
33
34 namespace System.Windows.Forms {
35
36         // XXX [TypeConverter (typeof (DataGridViewCellConverter))]
37         public abstract class DataGridViewCell : DataGridViewElement, ICloneable, IDisposable
38         {
39                 private DataGridView dataGridViewOwner;
40
41                 private AccessibleObject accessibilityObject;
42                 private int columnIndex;
43                 private Rectangle contentBounds;
44                 private ContextMenuStrip contextMenuStrip;
45                 private object defaultNewRowValue;
46                 private bool displayed;
47                 private object editedFormattedValue;
48                 private Type editType;
49                 private Rectangle errorIconBounds;
50                 private string errorText;
51                 private Type formattedValueType;
52                 private bool frozen;
53                 private DataGridViewElementStates inheritedState;
54                 private bool isInEditMode;
55                 private DataGridViewColumn owningColumn;
56                 private DataGridViewRow owningRow;
57                 private Size preferredSize;
58                 private bool readOnly;
59                 private bool resizable;
60                 private bool selected;
61                 private Size size;
62                 private DataGridViewCellStyle style;
63                 private object tag;
64                 private string toolTipText;
65                 private object valuex;
66                 private Type valueType;
67                 private bool visible;
68
69                 protected DataGridViewCell ()
70                 {
71                         columnIndex = -1;
72                 }
73
74                 ~DataGridViewCell ()
75                 {
76                         Dispose(false);
77                 }
78
79                 [Browsable (false)]
80                 public AccessibleObject AccessibilityObject {
81                         get {
82                                 if (accessibilityObject == null) {
83                                         accessibilityObject = CreateAccessibilityInstance();
84                                 }
85                                 return accessibilityObject;
86                         }
87                 }
88
89                 public int ColumnIndex {
90                         get { return columnIndex; }
91                 }
92
93                 [Browsable (false)]
94                 public Rectangle ContentBounds {
95                         get { return contentBounds; }
96                 }
97
98                 [DefaultValue (null)]
99                 public virtual ContextMenuStrip ContextMenuStrip {
100                         get { return contextMenuStrip; }
101                         set { contextMenuStrip = value; }
102                 }
103
104                 [Browsable (false)]
105                 public virtual object DefaultNewRowValue {
106                         get { return defaultNewRowValue; }
107                 }
108
109                 [Browsable (false)]
110                 public virtual bool Displayed {
111                         get { return displayed; }
112                 }
113
114                 [Browsable (false)]
115                 [EditorBrowsable (EditorBrowsableState.Advanced)]
116                 public object EditedFormattedValue {
117                         get { return editedFormattedValue; }
118                 }
119
120                 [Browsable (false)]
121                 [EditorBrowsable (EditorBrowsableState.Advanced)]
122                 public virtual Type EditType {
123                         get { return editType; }
124                 }
125
126                 [Browsable (false)]
127                 [EditorBrowsable (EditorBrowsableState.Advanced)]
128                 public Rectangle ErrorIconBounds {
129                         get { return errorIconBounds; }
130                 }
131
132                 [Browsable (false)]
133                 public string ErrorText {
134                         get { return errorText; }
135                         set {
136                                 if (errorText != value) {
137                                         errorText = value;
138                                         OnErrorTextChanged(new DataGridViewCellEventArgs(ColumnIndex, RowIndex));
139                                 }
140                         }
141                 }
142
143                 [Browsable (false)]
144                 public object FormattedValue {
145                         get {
146                                 DataGridViewCellStyle style = InheritedStyle;
147                                 if (style.Format != String.Empty && FormattedValueType == typeof(string)) {
148                                         return String.Format("{0:" + style.Format + "}", Value);
149                                 }
150                                 return Convert.ChangeType(Value, FormattedValueType, style.FormatProvider);
151                         }
152                 }
153
154                 [Browsable (false)]
155                 public virtual Type FormattedValueType {
156                         get { return formattedValueType; }
157                 }
158
159                 [Browsable (false)]
160                 public virtual bool Frozen {
161                         get { return frozen; }
162                 }
163
164                 [Browsable (false)]
165                 public bool HasStyle {
166                         get { return style != null; }
167                 }
168
169                 [Browsable (false)]
170                 public DataGridViewElementStates InheritedState {
171                         get { return inheritedState; }
172                 }
173
174                 [Browsable (false)]
175                 public DataGridViewCellStyle InheritedStyle {
176                         get {
177                                 DataGridViewCellStyle result = new DataGridViewCellStyle();
178                                 if (style != null && style.Alignment != DataGridViewContentAlignment.NotSet) {
179                                         result.Alignment = style.Alignment;
180                                 }
181                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
182                                         result.Alignment = OwningRow.DefaultCellStyle.Alignment;
183                                 }
184                                 else if (DataGridView != null) {
185                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
186                                                 result.Alignment = DataGridView.AlternatingRowsDefaultCellStyle.Alignment;
187                                         }
188                                         else if (DataGridView.RowsDefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
189                                                 result.Alignment = DataGridView.RowsDefaultCellStyle.Alignment;
190                                         }
191                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
192                                                 result.Alignment = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Alignment;
193                                         }
194                                         else {
195                                                 result.Alignment = DataGridView.DefaultCellStyle.Alignment;
196                                         }
197                                 }
198                                 if (style != null && style.BackColor != Color.Empty) {
199                                         result.BackColor = style.BackColor;
200                                 }
201                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.BackColor != Color.Empty) {
202                                         result.BackColor = OwningRow.DefaultCellStyle.BackColor;
203                                 }
204                                 else if (DataGridView != null) {
205                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.BackColor != Color.Empty) {
206                                                 result.BackColor = DataGridView.AlternatingRowsDefaultCellStyle.BackColor;
207                                         }
208                                         else if (DataGridView.RowsDefaultCellStyle.BackColor != Color.Empty) {
209                                                 result.BackColor = DataGridView.RowsDefaultCellStyle.BackColor;
210                                         }
211                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.BackColor != Color.Empty) {
212                                                 result.BackColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.BackColor;
213                                         }
214                                         else {
215                                                 result.BackColor = DataGridView.DefaultCellStyle.BackColor;
216                                         }
217                                 }
218                                 if (style != null && style.Font != null) {
219                                         result.Font = style.Font;
220                                 }
221                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.Font != null) {
222                                         result.Font = OwningRow.DefaultCellStyle.Font;
223                                 }
224                                 else if (DataGridView != null) {
225                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Font != null) {
226                                                 result.Font = DataGridView.AlternatingRowsDefaultCellStyle.Font;
227                                         }
228                                         else if (DataGridView.RowsDefaultCellStyle.Font != null) {
229                                                 result.Font = DataGridView.RowsDefaultCellStyle.Font;
230                                         }
231                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Font != null) {
232                                                 result.Font = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Font;
233                                         }
234                                         else {
235                                                 result.Font = DataGridView.DefaultCellStyle.Font;
236                                         }
237                                 }
238                                 if (style != null && style.ForeColor != Color.Empty) {
239                                         result.ForeColor = style.ForeColor;
240                                 }
241                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.ForeColor != Color.Empty) {
242                                         result.ForeColor = OwningRow.DefaultCellStyle.ForeColor;
243                                 }
244                                 else if (DataGridView != null) {
245                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.ForeColor != Color.Empty) {
246                                                 result.ForeColor = DataGridView.AlternatingRowsDefaultCellStyle.ForeColor;
247                                         }
248                                         else if (DataGridView.RowsDefaultCellStyle.ForeColor != Color.Empty) {
249                                                 result.ForeColor = DataGridView.RowsDefaultCellStyle.ForeColor;
250                                         }
251                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.ForeColor != Color.Empty) {
252                                                 result.ForeColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.ForeColor;
253                                         }
254                                         else {
255                                                 result.ForeColor = DataGridView.DefaultCellStyle.ForeColor;
256                                         }
257                                 }
258                                 if (style != null && style.Format != String.Empty) {
259                                         result.Format = style.Format;
260                                 }
261                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.Format != String.Empty) {
262                                         result.Format = OwningRow.DefaultCellStyle.Format;
263                                 }
264                                 else if (DataGridView != null) {
265                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Format != String.Empty) {
266                                                 result.Format = DataGridView.AlternatingRowsDefaultCellStyle.Format;
267                                         }
268                                         else if (DataGridView.RowsDefaultCellStyle.Format != String.Empty) {
269                                                 result.Format = DataGridView.RowsDefaultCellStyle.Format;
270                                         }
271                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Format != String.Empty) {
272                                                 result.Format = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Format;
273                                         }
274                                         else {
275                                                 result.Format = DataGridView.DefaultCellStyle.Format;
276                                         }
277                                 }
278                                 if (style != null && style.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
279                                         result.FormatProvider = style.FormatProvider;
280                                 }
281                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
282                                         result.FormatProvider = OwningRow.DefaultCellStyle.FormatProvider;
283                                 }
284                                 else if (DataGridView != null) {
285                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
286                                                 result.FormatProvider = DataGridView.AlternatingRowsDefaultCellStyle.FormatProvider;
287                                         }
288                                         else if (DataGridView.RowsDefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
289                                                 result.FormatProvider = DataGridView.RowsDefaultCellStyle.FormatProvider;
290                                         }
291                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
292                                                 result.FormatProvider = DataGridView.Columns[ColumnIndex].DefaultCellStyle.FormatProvider;
293                                         }
294                                         else {
295                                                 result.FormatProvider = DataGridView.DefaultCellStyle.FormatProvider;
296                                         }
297                                 }
298                                 if (style != null && (string) style.NullValue != "(null)") {
299                                         result.NullValue = style.NullValue;
300                                 }
301                                 else if (OwningRow != null && (string) OwningRow.DefaultCellStyle.NullValue != "(null)") {
302                                         result.NullValue = OwningRow.DefaultCellStyle.NullValue;
303                                 }
304                                 else if (DataGridView != null) {
305                                         if ((RowIndex % 2) == 1 && (string) DataGridView.AlternatingRowsDefaultCellStyle.NullValue != "(null)") {
306                                                 result.NullValue = DataGridView.AlternatingRowsDefaultCellStyle.NullValue;
307                                         }
308                                         else if ((string) DataGridView.RowsDefaultCellStyle.NullValue != "(null)") {
309                                                 result.NullValue = DataGridView.RowsDefaultCellStyle.NullValue;
310                                         }
311                                         else if (ColumnIndex >= 0 && (string) DataGridView.Columns[ColumnIndex].DefaultCellStyle.NullValue != "(null)") {
312                                                 result.NullValue = DataGridView.Columns[ColumnIndex].DefaultCellStyle.NullValue;
313                                         }
314                                         else {
315                                                 result.NullValue = DataGridView.DefaultCellStyle.NullValue;
316                                         }
317                                 }
318                                 if (style != null && style.Padding != Padding.Empty) {
319                                         result.Padding = style.Padding;
320                                 }
321                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.Padding != Padding.Empty) {
322                                         result.Padding = OwningRow.DefaultCellStyle.Padding;
323                                 }
324                                 else if (DataGridView != null) {
325                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Padding != Padding.Empty) {
326                                                 result.Padding = DataGridView.AlternatingRowsDefaultCellStyle.Padding;
327                                         }
328                                         else if (DataGridView.RowsDefaultCellStyle.Padding != Padding.Empty) {
329                                                 result.Padding = DataGridView.RowsDefaultCellStyle.Padding;
330                                         }
331                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Padding != Padding.Empty) {
332                                                 result.Padding = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Padding;
333                                         }
334                                         else {
335                                                 result.Padding = DataGridView.DefaultCellStyle.Padding;
336                                         }
337                                 }
338                                 if (style != null && style.SelectionBackColor != Color.Empty) {
339                                         result.SelectionBackColor = style.SelectionBackColor;
340                                 }
341                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.SelectionBackColor != Color.Empty) {
342                                         result.SelectionBackColor = OwningRow.DefaultCellStyle.SelectionBackColor;
343                                 }
344                                 else if (DataGridView != null) {
345                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.SelectionBackColor != Color.Empty) {
346                                                 result.SelectionBackColor = DataGridView.AlternatingRowsDefaultCellStyle.SelectionBackColor;
347                                         }
348                                         else if (DataGridView.RowsDefaultCellStyle.SelectionBackColor != Color.Empty) {
349                                                 result.SelectionBackColor = DataGridView.RowsDefaultCellStyle.SelectionBackColor;
350                                         }
351                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionBackColor != Color.Empty) {
352                                                 result.SelectionBackColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionBackColor;
353                                         }
354                                         else {
355                                                 result.SelectionBackColor = DataGridView.DefaultCellStyle.SelectionBackColor;
356                                         }
357                                 }
358                                 if (style != null && style.SelectionForeColor != Color.Empty) {
359                                         result.SelectionForeColor = style.SelectionForeColor;
360                                 }
361                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.SelectionForeColor != Color.Empty) {
362                                         result.SelectionForeColor = OwningRow.DefaultCellStyle.SelectionForeColor;
363                                 }
364                                 else if (DataGridView != null) {
365                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.SelectionForeColor != Color.Empty) {
366                                                 result.SelectionForeColor = DataGridView.AlternatingRowsDefaultCellStyle.SelectionForeColor;
367                                         }
368                                         else if (DataGridView.RowsDefaultCellStyle.SelectionForeColor != Color.Empty) {
369                                                 result.SelectionForeColor = DataGridView.RowsDefaultCellStyle.SelectionForeColor;
370                                         }
371                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionForeColor != Color.Empty) {
372                                                 result.SelectionForeColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionForeColor;
373                                         }
374                                         else {
375                                                 result.SelectionForeColor = DataGridView.DefaultCellStyle.SelectionForeColor;
376                                         }
377                                 }
378                                 if (style != null && style.Tag != null) {
379                                         result.Tag = style.Tag;
380                                 }
381                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.Tag != null) {
382                                         result.Tag = OwningRow.DefaultCellStyle.Tag;
383                                 }
384                                 else if (DataGridView != null) {
385                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Tag != null) {
386                                                 result.Tag = DataGridView.AlternatingRowsDefaultCellStyle.Tag;
387                                         }
388                                         else if (DataGridView.RowsDefaultCellStyle.Tag != null) {
389                                                 result.Tag = DataGridView.RowsDefaultCellStyle.Tag;
390                                         }
391                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Tag != null) {
392                                                 result.Tag = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Tag;
393                                         }
394                                         else {
395                                                 result.Tag = DataGridView.DefaultCellStyle.Tag;
396                                         }
397                                 }
398                                 if (style != null && style.WrapMode != DataGridViewTriState.NotSet) {
399                                         result.WrapMode = style.WrapMode;
400                                 }
401                                 else if (OwningRow != null && OwningRow.DefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
402                                         result.WrapMode = OwningRow.DefaultCellStyle.WrapMode;
403                                 }
404                                 else if (DataGridView != null) {
405                                         if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
406                                                 result.WrapMode = DataGridView.AlternatingRowsDefaultCellStyle.WrapMode;
407                                         }
408                                         else if (DataGridView.RowsDefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
409                                                 result.WrapMode = DataGridView.RowsDefaultCellStyle.WrapMode;
410                                         }
411                                         else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
412                                                 result.WrapMode = DataGridView.Columns[ColumnIndex].DefaultCellStyle.WrapMode;
413                                         }
414                                         else {
415                                                 result.WrapMode = DataGridView.DefaultCellStyle.WrapMode;
416                                         }
417                                 }
418                                 return result;
419                         }
420                 }
421
422                 [Browsable (false)]
423                 public bool IsInEditMode {
424                         get { return isInEditMode; }
425                 }
426
427                 [Browsable (false)]
428                 [EditorBrowsable (EditorBrowsableState.Advanced)]
429                 public DataGridViewColumn OwningColumn {
430                         get { return owningColumn; }
431                 }
432
433                 [Browsable (false)]
434                 [EditorBrowsable (EditorBrowsableState.Advanced)]
435                 public DataGridViewRow OwningRow {
436                         get { return owningRow; }
437                 }
438
439                 [Browsable (false)]
440                 public Size PreferredSize {
441                         get { return preferredSize; }
442                 }
443
444                 [Browsable (false)]
445                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
446                 public virtual bool ReadOnly {
447                         get { return readOnly; }
448                         set { readOnly = value; }
449                 }
450
451                 [Browsable (false)]
452                 public virtual bool Resizable {
453                         get { return resizable; }
454                 }
455
456                 [Browsable (false)]
457                 public int RowIndex {
458                         get {
459                                 if (owningRow == null) {
460                                         return -1;
461                                 }
462                                 return owningRow.Index;
463                         }
464                 }
465
466                 [Browsable (false)]
467                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
468                 public virtual bool Selected {
469                         get { return selected; }
470                         set {
471                                 if (value != ((State & DataGridViewElementStates.Selected) != 0)) {
472                                         SetState(State ^ DataGridViewElementStates.Selected);
473                                 }
474                                 selected = value;
475                         }
476                 }
477
478                 [Browsable (false)]
479                 public Size Size {
480                         get { return size; }
481                 }
482
483                 [Browsable (true)]
484                 public DataGridViewCellStyle Style {
485                         get {
486                                 if (style != null) {
487                                         style = new DataGridViewCellStyle();
488                                         style.StyleChanged += OnStyleChanged;
489                                 }
490                                 return style;
491                         }
492                         set { style = value; }
493                 }
494
495                 [Bindable (true, BindingDirection.OneWay)]
496                 [DefaultValue (null)]
497                 [Localizable (false)]
498                 [TypeConverter ("System.ComponentModel.StringConverter, " + Consts.AssemblySystem)]
499                 public object Tag {
500                         get { return tag; }
501                         set { tag = value; }
502                 }
503
504                 [Browsable (false)]
505                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
506                 public string ToolTipText {
507                         get { return toolTipText; }
508                         set { toolTipText = value; }
509                 }
510
511                 [Browsable (false)]
512                 public object Value {
513                         get { return valuex; }
514                         set {
515                                 if (valuex != value) {
516                                         valuex = value;
517                                         RaiseCellValueChanged(new DataGridViewCellEventArgs(ColumnIndex, RowIndex));
518                                 }
519                         }
520                 }
521
522                 [Browsable (false)]
523                 public virtual Type ValueType {
524                         get { return valueType; }
525                         set { valueType = value; }
526                 }
527
528                 [Browsable (false)]
529                 public virtual bool Visible {
530                         get { return visible; }
531                 }
532
533                 [EditorBrowsable (EditorBrowsableState.Advanced)]
534                 public virtual DataGridViewAdvancedBorderStyle AdjustCellBorderStyle (DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,     DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
535                         return dataGridViewAdvancedBorderStyleInput;
536                 }
537
538                 public virtual object Clone () {
539                         return this.MemberwiseClone();
540                         /*
541                         DataGridViewCell result = null; // = new DataGridViewCell();
542                         result.accessibilityObject = this.accessibilityObject;
543                         result.columnIndex = this.columnIndex;
544                         result.contentBounds = this.contentBounds;
545                         //result.contextMenuStrip = this.contextMenuStrip;
546                         result.defaultNewRowValue = this.defaultNewRowValue;
547                         result.displayed = this.displayed;
548                         result.editedFormattedValue = this.editedFormattedValue;
549                         result.editType = this.editType;
550                         result.errorIconBounds = this.errorIconBounds;
551                         result.errorText = this.errorText;
552                         result.formattedValueType = this.formattedValueType;
553                         result.frozen = this.frozen;
554                         result.hasStyle = this.hasStyle;
555                         result.inheritedState = this.inheritedState;
556                         result.inheritedStyle = this.inheritedStyle;
557                         result.isInEditMode = this.isInEditMode;
558                         result.owningColumn = this.owningColumn;
559                         result.owningRow = this.owningRow;
560                         result.preferredSize = this.preferredSize;
561                         result.readOnly = this.readOnly;
562                         result.resizable = this.resizable;
563                         result.selected = this.selected;
564                         result.size = this.size;
565                         result.style = this.style;
566                         result.tag = this.tag;
567                         result.toolTipText = this.toolTipText;
568                         result.valuex = this.valuex;
569                         result.valueType = this.valueType;
570                         result.visible = this.visible;
571                         return result;
572                         */
573                 }
574
575                 [EditorBrowsable (EditorBrowsableState.Advanced)]
576                 public virtual void DetachEditingControl () {
577                 }
578
579                 //public sealed void Dispose () {
580                 public void Dispose () {
581                 }
582
583                 public Rectangle GetContentBounds (int rowIndex) {
584                         throw new NotImplementedException();
585                 }
586
587                 public object GetEditedFormattedValue (int rowIndex, DataGridViewDataErrorContexts context) {
588                         throw new NotImplementedException();
589                 }
590
591                 public virtual ContextMenuStrip GetInheritedContextMenuStrip (int rowIndex)
592                 {
593                         throw new NotImplementedException();
594                 }
595
596                 public virtual DataGridViewElementStates GetInheritedState (int rowIndex) {
597                         throw new NotImplementedException();
598                 }
599
600                 public virtual DataGridViewCellStyle GetInheritedStyle (DataGridViewCellStyle inheritedCellStyle, int rowIndex, bool includeColors) {
601                         /*
602                          * System.InvalidOperationException :: The cell has no associated System.Windows.Forms.DataGridView, or the cell's System.Windows.Forms.DataGridViewCell.ColumnIndex is less than 0.
603                          * System.ArgumentOutOfRangeException :: rowIndex is less than 0, or greater than or equal to the number of rows in the parent System.Windows.Forms.DataGridView.
604                          * */
605                         throw new NotImplementedException();
606                 }
607
608                 [EditorBrowsable (EditorBrowsableState.Advanced)]
609                 public virtual void InitializeEditingControl (int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) {
610                         if (DataGridView == null || DataGridView.EditingControl == null) {
611                                 throw new InvalidOperationException("No editing control defined");
612                         }
613                 }
614
615                 public virtual bool KeyEntersEditMode (KeyEventArgs e) {
616                         throw new NotImplementedException();
617                 }
618
619                 [EditorBrowsable (EditorBrowsableState.Advanced)]
620                 public static int MeasureTextHeight (Graphics graphics, string text, Font font, int maxWidth, TextFormatFlags flags) {
621                         if (graphics == null) {
622                                 throw new ArgumentNullException("Graphics argument null");
623                         }
624                         if (font == null) {
625                                 throw new ArgumentNullException("Font argument null");
626                         }
627                         if (maxWidth < 1) {
628                                 throw new ArgumentOutOfRangeException("maxWidth is less than 1.");
629                         }
630                         // if (flags ---> InvalidEnumArgumentException  
631                         throw new NotImplementedException();
632                 }
633
634                 [EditorBrowsable (EditorBrowsableState.Advanced)]
635                 public static int MeasureTextHeight (Graphics graphics, string text, Font font, int maxWidth, TextFormatFlags flags, out bool widthTruncated) {
636                         throw new NotImplementedException();
637                 }
638
639                 [EditorBrowsable (EditorBrowsableState.Advanced)]
640                 public static Size MeasureTextPreferredSize (Graphics graphics, string text, Font font, float maxRatio, TextFormatFlags flags) {
641                         if (graphics == null) {
642                                 throw new ArgumentNullException("Graphics argument null");
643                         }
644                         if (font == null) {
645                                 throw new ArgumentNullException("Font argument null");
646                         }
647                         if (maxRatio <= 0) {
648                                 throw new ArgumentOutOfRangeException("maxRatio is less than or equals to 0.");
649                         }
650                         throw new NotImplementedException();
651                 }
652
653                 [EditorBrowsable (EditorBrowsableState.Advanced)]
654                 public static Size MeasureTextSize (Graphics graphics, string text, Font font, TextFormatFlags flags) {
655                         /////////////////////////// Â¿flags?
656                         return graphics.MeasureString(text, font).ToSize();
657                 }
658
659                 [EditorBrowsable (EditorBrowsableState.Advanced)]
660                 public static int MeasureTextWidth (Graphics graphics, string text, Font font, int maxHeight, TextFormatFlags flags) {
661                         if (graphics == null) {
662                                 throw new ArgumentNullException("Graphics argument null");
663                         }
664                         if (font == null) {
665                                 throw new ArgumentNullException("Font argument null");
666                         }
667                         if (maxHeight < 1) {
668                                 throw new ArgumentOutOfRangeException("maxHeight is less than 1.");
669                         }
670                         throw new NotImplementedException();
671                 }
672
673                 public virtual object ParseFormattedValue (object formattedValue, DataGridViewCellStyle cellStyle, TypeConverter formattedValueTypeConverter, TypeConverter valueTypeConverter) {
674                         if (cellStyle == null) {
675                                 throw new ArgumentNullException("cellStyle is null.");
676                         }
677                         if (formattedValueType == null) {
678                                 throw new FormatException("The System.Windows.Forms.DataGridViewCell.FormattedValueType property value is null.");
679                         }
680                         if (formattedValue == null) {
681                                 throw new ArgumentException("formattedValue is null.");
682                         }
683                         if (formattedValue.GetType() != formattedValueType) {
684                         }
685                         return null;
686                 }
687
688                 [EditorBrowsable (EditorBrowsableState.Advanced)]
689                 public virtual void PositionEditingControl (bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
690                         throw new NotImplementedException();
691                 }
692
693                 [EditorBrowsable (EditorBrowsableState.Advanced)]
694                 public virtual Rectangle PositionEditingPanel (Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
695                         throw new NotImplementedException();
696                 }
697
698                 public override string ToString () {
699                         return String.Format("{0} {RowIndex = {1}, ColumnIndex = {2}}", this.GetType().FullName, RowIndex, columnIndex);
700                 }
701
702                 protected virtual Rectangle BorderWidths (DataGridViewAdvancedBorderStyle advancedBorderStyle)
703                 {
704                         throw new NotImplementedException();
705                 }
706
707                 protected virtual bool ClickUnsharesRow (DataGridViewCellEventArgs e)
708                 {
709                         throw new NotImplementedException();
710                 }
711
712                 protected virtual bool ContentClickUnsharesRow (DataGridViewCellEventArgs e)
713                 {
714                         throw new NotImplementedException();
715                 }
716
717                 protected virtual bool ContentDoubleClickUnsharesRow (DataGridViewCellEventArgs e)
718                 {
719                         throw new NotImplementedException();
720                 }
721
722                 protected virtual AccessibleObject CreateAccessibilityInstance () {
723                         return new DataGridViewCellAccessibleObject(this);
724                 }
725
726                 protected virtual void Dispose (bool disposing) {
727                 }
728
729                 protected virtual bool DoubleClickUnsharesRow (DataGridViewCellEventArgs e) {
730                         throw new NotImplementedException();
731                 }
732
733                 protected virtual bool EnterUnsharesRow (int rowIndex, bool throughMouseClick) {
734                         throw new NotImplementedException();
735                 }
736
737                 protected virtual object GetClipboardContent (int rowIndex, bool firstCell, bool lastCell, bool inFirstRow, bool inLastRow, string format) {
738                         throw new NotImplementedException();
739                 }
740
741                 protected virtual Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
742                         throw new NotImplementedException();
743                 }
744
745                 protected virtual Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
746                         throw new NotImplementedException();
747                 }
748
749                 protected internal virtual string GetErrorText (int rowIndex) {
750                         throw new NotImplementedException();
751                 }
752
753                 protected virtual object GetFormattedValue (object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
754                 {
755                         throw new NotImplementedException();
756                 }
757
758                 protected virtual Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
759                         throw new NotImplementedException();
760                 }
761
762                 protected virtual Size GetSize (int rowIndex) {
763                         throw new NotImplementedException();
764                 }
765
766                 protected virtual object GetValue (int rowIndex) {
767                         throw new NotImplementedException();
768                 }
769
770                 protected virtual bool KeyDownUnsharesRow (KeyEventArgs e, int rowIndex) {
771                         throw new NotImplementedException();
772                 }
773
774                 protected virtual bool KeyPressUnsharesRow (KeyPressEventArgs e, int rowIndex) {
775                         throw new NotImplementedException();
776                 }
777
778                 protected virtual bool KeyUpUnsharesRow (KeyEventArgs e, int rowIndex) {
779                         throw new NotImplementedException();
780                 }
781
782                 protected virtual bool LeaveUnsharesRow (int rowIndex, bool throughMouseClick) {
783                         throw new NotImplementedException();
784                 }
785
786                 protected virtual bool MouseClickUnsharesRow (DataGridViewCellMouseEventArgs e) {
787                         throw new NotImplementedException();
788                 }
789
790                 protected virtual bool MouseDoubleClickUnsharesRow (DataGridViewCellMouseEventArgs e) {
791                         throw new NotImplementedException();
792                 }
793
794                 protected virtual bool MouseDownUnsharesRow (DataGridViewCellMouseEventArgs e) {
795                         throw new NotImplementedException();
796                 }
797
798                 protected virtual bool MouseEnterUnsharesRow (int rowIndex) {
799                         throw new NotImplementedException();
800                 }
801
802                 protected virtual bool MouseLeaveUnsharesRow (int rowIndex) {
803                         throw new NotImplementedException();
804                 }
805
806                 protected virtual bool MouseMoveUnsharesRow (DataGridViewCellMouseEventArgs e) {
807                         throw new NotImplementedException();
808                 }
809
810                 protected virtual bool MouseUpUnsharesRow (DataGridViewCellMouseEventArgs e) {
811                         throw new NotImplementedException();
812                 }
813
814                 protected virtual void OnClick (DataGridViewCellEventArgs e) {
815                 }
816
817                 protected virtual void OnContentClick (DataGridViewCellEventArgs e) {
818                 }
819
820                 protected virtual void OnContentDoubleClick (DataGridViewCellEventArgs e) {
821                 }
822
823                 protected override void OnDataGridViewChanged () {
824                 }
825
826                 protected virtual void OnDoubleClick (DataGridViewCellEventArgs e) {
827                 }
828
829                 protected virtual void OnEnter (int rowIndex, bool throughMouseClick) {
830                 }
831
832                 protected virtual void OnKeyDown (KeyEventArgs e, int rowIndex) {
833                 }
834
835                 protected virtual void OnKeyPress (KeyPressEventArgs e, int rowIndex) {
836                 }
837
838                 protected virtual void OnKeyUp (KeyEventArgs e, int rowIndex) {
839                 }
840
841                 protected virtual void OnLeave (int rowIndex, bool throughMouseClick) {
842                 }
843
844                 protected virtual void OnMouseClick (DataGridViewCellMouseEventArgs e) {
845                 }
846
847                 protected virtual void OnMouseDoubleClick (DataGridViewCellMouseEventArgs e) {
848                 }
849
850                 protected virtual void OnMouseDown (DataGridViewCellMouseEventArgs e) {
851                 }
852
853                 protected virtual void OnMouseEnter (int rowIndex) {
854                 }
855
856                 protected virtual void OnMouseLeave (int rowIndex) {
857                 }
858
859                 protected virtual void OnMouseMove (DataGridViewCellMouseEventArgs e) {
860                 }
861
862                 protected virtual void OnMouseUp (DataGridViewCellMouseEventArgs e) {
863                 }
864
865                 protected virtual void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
866                         throw new NotImplementedException();
867                 }
868
869                 protected virtual void PaintBorder (Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle) {
870                         Pen pen = new Pen(DataGridView.GridColor);
871                         /*
872                         switch (advancedBorderStyle.All) {
873                                 case DataGridViewAdvancedCellBorderStyle.None:
874                                         break;
875                                 case DataGridViewAdvancedCellBorderStyle.Single:
876                                         graphics.DrawRectangle(pen, bounds);
877                                         break;
878                                 case DataGridViewAdvancedCellBorderStyle.Inset:
879                                         bounds.X += 1;
880                                         bounds.Y += 1;
881                                         bounds.Width -= 2;
882                                         bounds.Height -= 2;
883                                         graphics.DrawRectangle(pen, bounds);
884                                         break;
885                                 case DataGridViewAdvancedCellBorderStyle.InsetDouble:
886                                 case DataGridViewAdvancedCellBorderStyle.Outset:
887                                 case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
888                                 case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
889                                         break;
890                                 case DataGridViewAdvancedCellBorderStyle.NotSet:
891                                 */
892                                         switch (advancedBorderStyle.Left) {
893                                                 case DataGridViewAdvancedCellBorderStyle.None:
894                                                         break;
895                                                 case DataGridViewAdvancedCellBorderStyle.Single:
896                                                         graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height - 1);
897                                                         break;
898                                                 case DataGridViewAdvancedCellBorderStyle.Inset:
899                                                         graphics.DrawLine(pen, bounds.X + 2, bounds.Y, bounds.X + 2, bounds.Y + bounds.Height - 1);
900                                                         break;
901                                                 case DataGridViewAdvancedCellBorderStyle.InsetDouble:
902                                                 case DataGridViewAdvancedCellBorderStyle.Outset:
903                                                 case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
904                                                         graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height - 1);
905                                                         graphics.DrawLine(pen, bounds.X + 2, bounds.Y, bounds.X + 2, bounds.Y + bounds.Height - 1);
906                                                         break;
907                                                 case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
908                                                         break;
909                                         }
910                                         switch (advancedBorderStyle.Right) {
911                                                 case DataGridViewAdvancedCellBorderStyle.None:
912                                                         break;
913                                                 case DataGridViewAdvancedCellBorderStyle.Single:
914                                                         graphics.DrawLine(pen, bounds.X + bounds.Width - 1, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
915                                                         break;
916                                                 case DataGridViewAdvancedCellBorderStyle.Inset:
917                                                         graphics.DrawLine(pen, bounds.X + bounds.Width + 1, bounds.Y, bounds.X + bounds.Width - 3, bounds.Y + bounds.Height - 1);
918                                                         break;
919                                                 case DataGridViewAdvancedCellBorderStyle.InsetDouble:
920                                                 case DataGridViewAdvancedCellBorderStyle.Outset:
921                                                 case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
922                                                 case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
923                                                         break;
924                                         }
925                                         switch (advancedBorderStyle.Top) {
926                                                 case DataGridViewAdvancedCellBorderStyle.None:
927                                                         break;
928                                                 case DataGridViewAdvancedCellBorderStyle.Single:
929                                                         graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y);
930                                                         break;
931                                                 case DataGridViewAdvancedCellBorderStyle.Inset:
932                                                         graphics.DrawLine(pen, bounds.X, bounds.Y + 2, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height + 1);
933                                                         break;
934                                                 case DataGridViewAdvancedCellBorderStyle.InsetDouble:
935                                                 case DataGridViewAdvancedCellBorderStyle.Outset:
936                                                 case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
937                                                 case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
938                                                         break;
939                                         }
940                                         switch (advancedBorderStyle.Bottom) {
941                                                 case DataGridViewAdvancedCellBorderStyle.None:
942                                                         break;
943                                                 case DataGridViewAdvancedCellBorderStyle.Single:
944                                                         graphics.DrawLine(pen, bounds.X, bounds.Y + bounds.Height - 1, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
945                                                         break;
946                                                 case DataGridViewAdvancedCellBorderStyle.Inset:
947                                                 case DataGridViewAdvancedCellBorderStyle.InsetDouble:
948                                                 case DataGridViewAdvancedCellBorderStyle.Outset:
949                                                 case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
950                                                 case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
951                                                         break;
952                                         }
953                         //              break;
954                         //}
955                 }
956
957                 protected virtual void PaintErrorIcon (Graphics graphics, Rectangle clipBounds, Rectangle cellValueBounds, string errorText) {
958                         throw new NotImplementedException();
959                 }
960
961                 protected virtual bool SetValue (int rowIndex, object value) {
962                         throw new NotImplementedException();
963                 }
964
965                 private void OnStyleChanged (object sender, EventArgs args) {
966                         if (DataGridView != null) {
967                                 DataGridView.RaiseCellStyleChanged(new DataGridViewCellEventArgs(ColumnIndex, RowIndex));
968                         }
969                 }
970
971                 internal void InternalPaint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
972                         Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
973                 }
974
975                 internal void SetOwningRow (DataGridViewRow row) {
976                         owningRow = row;
977                 }
978
979                 internal void SetColumnIndex (int index) {
980                         columnIndex = index;
981                 }
982
983                 internal void SetContentBounds (Rectangle bounds) {
984                         contentBounds = bounds;
985                 }
986
987                 internal void SetIsInEditMode (bool isInEditMode) {
988                         this.isInEditMode = isInEditMode;
989                 }
990
991                 internal void SetSize (Size size) {
992                         this.size = size;
993                 }
994
995                 internal void OnErrorTextChanged (DataGridViewCellEventArgs args) {
996                         if (DataGridView != null) {
997                                 DataGridView.OnCellErrorTextChanged(args);
998                         }
999                 }
1000
1001                 [ComVisibleAttribute(true)]
1002                 protected class DataGridViewCellAccessibleObject : AccessibleObject {
1003
1004                         private DataGridViewCell dataGridViewCell;
1005
1006                         public DataGridViewCellAccessibleObject () {
1007                         }
1008
1009                         public DataGridViewCellAccessibleObject (DataGridViewCell cell) {
1010                                 this.dataGridViewCell = cell;
1011                         }
1012
1013                         public override Rectangle Bounds {
1014                                 get { throw new NotImplementedException(); }
1015                         }
1016
1017                         public override string DefaultAction {
1018                                 get { return "Edit"; }
1019                         }
1020
1021                         public override string Name {
1022                                 get { return dataGridViewCell.OwningColumn.HeaderText + ": " + dataGridViewCell.RowIndex.ToString(); }
1023                         }
1024
1025                         public DataGridViewCell Owner {
1026                                 get { return dataGridViewCell; }
1027                                 set { dataGridViewCell = value; }
1028                         }
1029
1030                         public override AccessibleObject Parent {
1031                                 get { return dataGridViewCell.OwningRow.AccessibilityObject; }
1032                         }
1033
1034                         public override AccessibleRole Role {
1035                                 get { return AccessibleRole.Cell; }
1036                         }
1037
1038                         public override AccessibleStates State {
1039                                 get {
1040                                         if (dataGridViewCell.Selected) {
1041                                                 return AccessibleStates.Selected;
1042                                         }
1043                                         else {
1044                                                 return AccessibleStates.Focused;
1045                                         }
1046                                 }
1047                         }
1048
1049                         public override string Value {
1050                                 get {
1051                                         if (dataGridViewCell.FormattedValue == null) {
1052                                                 return "(null)";
1053                                         }
1054                                         return dataGridViewCell.FormattedValue.ToString();
1055                                 }
1056                         }
1057
1058                         public override void DoDefaultAction () {
1059                                 if (dataGridViewCell.DataGridView.EditMode != DataGridViewEditMode.EditProgrammatically) {
1060                                         if (dataGridViewCell.IsInEditMode) {
1061                                                 // commit edit
1062                                         }
1063                                         else {
1064                                                 // begin edit
1065                                         }
1066                                 }
1067                         }
1068
1069                         public override AccessibleObject GetChild (int index) {
1070                                 throw new NotImplementedException();
1071                         }
1072
1073                         public override int GetChildCount () {
1074                                 if (dataGridViewCell.IsInEditMode) {
1075                                         return 1;
1076                                 }
1077                                 return -1;
1078                         }
1079
1080                         public override AccessibleObject GetFocused () {
1081                                 return null;
1082                         }
1083
1084                         public override AccessibleObject GetSelected () {
1085                                 return null;
1086                         }
1087
1088                         public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
1089                                 switch (navigationDirection) {
1090                                         case AccessibleNavigation.Right:
1091                                                 break;
1092                                         case AccessibleNavigation.Left:
1093                                                 break;
1094                                         case AccessibleNavigation.Next:
1095                                                 break;
1096                                         case AccessibleNavigation.Previous:
1097                                                 break;
1098                                         case AccessibleNavigation.Up:
1099                                                 break;
1100                                         case AccessibleNavigation.Down:
1101                                                 break;
1102                                         default:
1103                                                 return null;
1104                                 }
1105                                 return null;
1106                         }
1107
1108                         public override void Select (AccessibleSelection flags) {
1109                                 switch (flags) {
1110                                         case AccessibleSelection.TakeFocus:
1111                                                 dataGridViewCell.dataGridViewOwner.Focus();
1112                                                 break;
1113                                         case AccessibleSelection.TakeSelection:
1114                                                 //dataGridViewCell.Focus();
1115                                                 break;
1116                                         case AccessibleSelection.AddSelection:
1117                                                 dataGridViewCell.dataGridViewOwner.SelectedCells.InternalAdd(dataGridViewCell);
1118                                                 break;
1119                                         case AccessibleSelection.RemoveSelection:
1120                                                 dataGridViewCell.dataGridViewOwner.SelectedCells.InternalRemove(dataGridViewCell);
1121                                                 break;
1122                                 }
1123                         }
1124
1125                 }
1126
1127         }
1128
1129 }
1130
1131 #endif