Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewTextBoxColumn.cs / 1 / DataGridViewTextBoxColumn.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms
{
using System;
using System.Text;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
///
[ToolboxBitmapAttribute(typeof(DataGridViewTextBoxColumn), "DataGridViewTextBoxColumn.bmp")]
public class DataGridViewTextBoxColumn : DataGridViewColumn
{
private const int DATAGRIDVIEWTEXTBOXCOLUMN_maxInputLength = 32767;
///
public DataGridViewTextBoxColumn() : base(new DataGridViewTextBoxCell())
{
this.SortMode = DataGridViewColumnSortMode.Automatic;
}
///
[
Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
]
public override DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (value != null && !(value is System.Windows.Forms.DataGridViewTextBoxCell))
{
throw new InvalidCastException(SR.GetString(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewTextBoxCell"));
}
base.CellTemplate = value;
}
}
///
[
DefaultValue(DATAGRIDVIEWTEXTBOXCOLUMN_maxInputLength),
SRCategory(SR.CatBehavior),
SRDescription(SR.DataGridView_TextBoxColumnMaxInputLengthDescr)
]
public int MaxInputLength
{
get
{
if (this.TextBoxCellTemplate == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewColumn_CellTemplateRequired));
}
return this.TextBoxCellTemplate.MaxInputLength;
}
set
{
if (this.MaxInputLength != value)
{
this.TextBoxCellTemplate.MaxInputLength = value;
if (this.DataGridView != null)
{
DataGridViewRowCollection dataGridViewRows = this.DataGridView.Rows;
int rowCount = dataGridViewRows.Count;
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
{
DataGridViewRow dataGridViewRow = dataGridViewRows.SharedRow(rowIndex);
DataGridViewTextBoxCell dataGridViewCell = dataGridViewRow.Cells[this.Index] as DataGridViewTextBoxCell;
if (dataGridViewCell != null)
{
dataGridViewCell.MaxInputLength = value;
}
}
}
}
}
}
///
[
DefaultValue(DataGridViewColumnSortMode.Automatic)
]
public new DataGridViewColumnSortMode SortMode
{
get
{
return base.SortMode;
}
set
{
base.SortMode = value;
}
}
private DataGridViewTextBoxCell TextBoxCellTemplate
{
get
{
return (DataGridViewTextBoxCell) this.CellTemplate;
}
}
///
public override string ToString()
{
StringBuilder sb = new StringBuilder(64);
sb.Append("DataGridViewTextBoxColumn { Name=");
sb.Append(this.Name);
sb.Append(", Index=");
sb.Append(this.Index.ToString(CultureInfo.CurrentCulture));
sb.Append(" }");
return sb.ToString();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms
{
using System;
using System.Text;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
///
[ToolboxBitmapAttribute(typeof(DataGridViewTextBoxColumn), "DataGridViewTextBoxColumn.bmp")]
public class DataGridViewTextBoxColumn : DataGridViewColumn
{
private const int DATAGRIDVIEWTEXTBOXCOLUMN_maxInputLength = 32767;
///
public DataGridViewTextBoxColumn() : base(new DataGridViewTextBoxCell())
{
this.SortMode = DataGridViewColumnSortMode.Automatic;
}
///
[
Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
]
public override DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (value != null && !(value is System.Windows.Forms.DataGridViewTextBoxCell))
{
throw new InvalidCastException(SR.GetString(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewTextBoxCell"));
}
base.CellTemplate = value;
}
}
///
[
DefaultValue(DATAGRIDVIEWTEXTBOXCOLUMN_maxInputLength),
SRCategory(SR.CatBehavior),
SRDescription(SR.DataGridView_TextBoxColumnMaxInputLengthDescr)
]
public int MaxInputLength
{
get
{
if (this.TextBoxCellTemplate == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewColumn_CellTemplateRequired));
}
return this.TextBoxCellTemplate.MaxInputLength;
}
set
{
if (this.MaxInputLength != value)
{
this.TextBoxCellTemplate.MaxInputLength = value;
if (this.DataGridView != null)
{
DataGridViewRowCollection dataGridViewRows = this.DataGridView.Rows;
int rowCount = dataGridViewRows.Count;
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
{
DataGridViewRow dataGridViewRow = dataGridViewRows.SharedRow(rowIndex);
DataGridViewTextBoxCell dataGridViewCell = dataGridViewRow.Cells[this.Index] as DataGridViewTextBoxCell;
if (dataGridViewCell != null)
{
dataGridViewCell.MaxInputLength = value;
}
}
}
}
}
}
///
[
DefaultValue(DataGridViewColumnSortMode.Automatic)
]
public new DataGridViewColumnSortMode SortMode
{
get
{
return base.SortMode;
}
set
{
base.SortMode = value;
}
}
private DataGridViewTextBoxCell TextBoxCellTemplate
{
get
{
return (DataGridViewTextBoxCell) this.CellTemplate;
}
}
///
public override string ToString()
{
StringBuilder sb = new StringBuilder(64);
sb.Append("DataGridViewTextBoxColumn { Name=");
sb.Append(this.Name);
sb.Append(", Index=");
sb.Append(this.Index.ToString(CultureInfo.CurrentCulture));
sb.Append(" }");
return sb.ToString();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PreProcessInputEventArgs.cs
- EntityViewGenerator.cs
- LogArchiveSnapshot.cs
- Style.cs
- CacheSection.cs
- SignedXml.cs
- AlignmentXValidation.cs
- XmlSchemaCompilationSettings.cs
- HttpGetProtocolReflector.cs
- InternalEnumValidator.cs
- IISUnsafeMethods.cs
- XmlChoiceIdentifierAttribute.cs
- ProcessProtocolHandler.cs
- MetabaseServerConfig.cs
- TreeBuilderXamlTranslator.cs
- FixedPageProcessor.cs
- shaper.cs
- DesignerDataTableBase.cs
- MessageSecurityException.cs
- XmlEnumAttribute.cs
- TopClause.cs
- CommentEmitter.cs
- HwndMouseInputProvider.cs
- TimeoutException.cs
- XpsDigitalSignature.cs
- BinHexEncoding.cs
- TableTextElementCollectionInternal.cs
- XmlSchemaParticle.cs
- PauseStoryboard.cs
- HttpStreams.cs
- GlyphCache.cs
- XmlBinaryWriterSession.cs
- ModelMemberCollection.cs
- DataSourceExpression.cs
- HMACSHA256.cs
- RuleSettingsCollection.cs
- AdapterUtil.cs
- MultiTrigger.cs
- DataGridViewRowHeaderCell.cs
- Serializer.cs
- ListItemViewAttribute.cs
- WizardForm.cs
- FocusWithinProperty.cs
- ProcessHostServerConfig.cs
- XsltArgumentList.cs
- JsonSerializer.cs
- ClientSettingsSection.cs
- StrokeSerializer.cs
- EditorPartChrome.cs
- WebServiceErrorEvent.cs
- CultureSpecificStringDictionary.cs
- SemanticBasicElement.cs
- AssemblyBuilder.cs
- PrinterSettings.cs
- AssemblyInfo.cs
- HandledMouseEvent.cs
- StrongName.cs
- XmlCharCheckingWriter.cs
- XsdBuildProvider.cs
- ZoneIdentityPermission.cs
- EntityClassGenerator.cs
- WeakEventTable.cs
- ConfigurationSchemaErrors.cs
- ActivityCollectionMarkupSerializer.cs
- CompositeFontInfo.cs
- ListItem.cs
- DataAdapter.cs
- FlowDocumentReader.cs
- HttpWrapper.cs
- HandledMouseEvent.cs
- EventRouteFactory.cs
- ItemDragEvent.cs
- IsolatedStorageSecurityState.cs
- Number.cs
- HttpListenerException.cs
- Triangle.cs
- GenericAuthenticationEventArgs.cs
- TraceLog.cs
- LicenseException.cs
- XmlAnyAttributeAttribute.cs
- XamlToRtfWriter.cs
- ArcSegment.cs
- XPathArrayIterator.cs
- AmbientLight.cs
- Fonts.cs
- SkipStoryboardToFill.cs
- TypeEnumerableViewSchema.cs
- oledbconnectionstring.cs
- TableHeaderCell.cs
- StringFormat.cs
- CompilerGlobalScopeAttribute.cs
- XmlValueConverter.cs
- RepeaterCommandEventArgs.cs
- SecurityContextSecurityToken.cs
- Stopwatch.cs
- UpDownBase.cs
- ListItemDetailViewAttribute.cs
- XmlUtf8RawTextWriter.cs
- TdsParserSafeHandles.cs
- SqlServer2KCompatibilityCheck.cs