Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BitmapData.cs
- GeometryValueSerializer.cs
- BooleanFacetDescriptionElement.cs
- MarkupExtensionParser.cs
- FilteredDataSetHelper.cs
- ClientBuildManager.cs
- XsltInput.cs
- SignatureHelper.cs
- WebPartZone.cs
- MemberAccessException.cs
- XmlSchemaComplexType.cs
- ClientTargetSection.cs
- GeneralTransform.cs
- EventArgs.cs
- Tracer.cs
- List.cs
- ExtenderProvidedPropertyAttribute.cs
- Listen.cs
- _ChunkParse.cs
- ValidationPropertyAttribute.cs
- EntitySetRetriever.cs
- RefreshEventArgs.cs
- Propagator.ExtentPlaceholderCreator.cs
- SmtpDateTime.cs
- WebBrowserSiteBase.cs
- AuthStoreRoleProvider.cs
- ExpressionEditorAttribute.cs
- ScriptingJsonSerializationSection.cs
- FilteredXmlReader.cs
- QilXmlReader.cs
- ProcessHost.cs
- NameNode.cs
- ValueSerializer.cs
- ContentPresenter.cs
- AuthenticationException.cs
- XamlTypeMapperSchemaContext.cs
- GridViewCancelEditEventArgs.cs
- ResourceContainer.cs
- ChangeConflicts.cs
- NullableDoubleAverageAggregationOperator.cs
- BindingExpressionBase.cs
- ZoneButton.cs
- FrameworkElementFactory.cs
- ImageEditor.cs
- URLEditor.cs
- SqlVisitor.cs
- Queue.cs
- XmlILModule.cs
- DrawingCollection.cs
- CounterNameConverter.cs
- WebPartVerbCollection.cs
- PropagatorResult.cs
- SingleAnimation.cs
- UpdateDelegates.Generated.cs
- XmlSchemaImport.cs
- BamlVersionHeader.cs
- RawStylusInputCustomData.cs
- StringFreezingAttribute.cs
- DataViewListener.cs
- GridViewRow.cs
- filewebresponse.cs
- ParserContext.cs
- NavigationWindowAutomationPeer.cs
- SByteStorage.cs
- CompilerError.cs
- ScriptReferenceEventArgs.cs
- InheritablePropertyChangeInfo.cs
- XmlTextReaderImplHelpers.cs
- RowTypePropertyElement.cs
- SecurityManager.cs
- DrawTreeNodeEventArgs.cs
- ScriptingJsonSerializationSection.cs
- HttpEncoderUtility.cs
- BaseTreeIterator.cs
- FormViewInsertEventArgs.cs
- RichTextBoxDesigner.cs
- ReflectEventDescriptor.cs
- ColumnMapVisitor.cs
- SystemWebSectionGroup.cs
- HttpWebRequestElement.cs
- ILGenerator.cs
- EntityUtil.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- NameValuePermission.cs
- XmlArrayAttribute.cs
- DocumentPageHost.cs
- BadImageFormatException.cs
- EncryptedType.cs
- DataServiceHostFactory.cs
- InstanceKeyCollisionException.cs
- DifferencingCollection.cs
- Encoder.cs
- UriSectionData.cs
- StructuredCompositeActivityDesigner.cs
- PtsContext.cs
- DataGrid.cs
- Aggregates.cs
- ScrollChrome.cs
- HostedTransportConfigurationBase.cs
- WindowsHyperlink.cs