Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- QueuePathDialog.cs
- CodeTypeReference.cs
- DashStyle.cs
- EntityCommandDefinition.cs
- PerformanceCounterLib.cs
- EntityContainerEntitySet.cs
- ListViewItemSelectionChangedEvent.cs
- mda.cs
- DetailsViewDesigner.cs
- Floater.cs
- MarkupCompilePass1.cs
- SchemaContext.cs
- WsdlBuildProvider.cs
- ServiceNameCollection.cs
- PersonalizationStateInfo.cs
- RichTextBoxConstants.cs
- ComEventsMethod.cs
- OleDbDataReader.cs
- MemoryFailPoint.cs
- ScaleTransform.cs
- WebControl.cs
- DetailsView.cs
- XPathArrayIterator.cs
- CalendarDateRange.cs
- OracleRowUpdatingEventArgs.cs
- Object.cs
- TemplateAction.cs
- SoapAttributes.cs
- Mappings.cs
- XmlLinkedNode.cs
- arclist.cs
- DateTimeOffset.cs
- HelpProvider.cs
- EDesignUtil.cs
- XmlDomTextWriter.cs
- ToolTip.cs
- ByteRangeDownloader.cs
- VectorValueSerializer.cs
- ComponentCollection.cs
- DateTimeConstantAttribute.cs
- SessionStateSection.cs
- WaitForChangedResult.cs
- ProfileParameter.cs
- DesignerDeviceConfig.cs
- MultipleViewPattern.cs
- SystemSounds.cs
- Panel.cs
- _CacheStreams.cs
- FixedPageProcessor.cs
- ThreadExceptionEvent.cs
- validationstate.cs
- HMACSHA1.cs
- TrackingProfileManager.cs
- ArrayConverter.cs
- XmlSerializationWriter.cs
- SettingsProviderCollection.cs
- MimeXmlImporter.cs
- KeyGesture.cs
- Int32RectValueSerializer.cs
- GridViewRowPresenter.cs
- XmlEnumAttribute.cs
- RegexWorker.cs
- TTSEngineTypes.cs
- UpdatableWrapper.cs
- RemotingSurrogateSelector.cs
- Wildcard.cs
- AttributeTable.cs
- FamilyTypefaceCollection.cs
- RTLAwareMessageBox.cs
- MultiTargetingUtil.cs
- CatalogZone.cs
- RegexMatchCollection.cs
- Lease.cs
- Setter.cs
- ToolTipService.cs
- Stackframe.cs
- FatalException.cs
- AmbiguousMatchException.cs
- XsdCachingReader.cs
- EntityDataSourceEntitySetNameItem.cs
- EventListenerClientSide.cs
- mediaeventargs.cs
- ComNativeDescriptor.cs
- GuidConverter.cs
- HtmlTitle.cs
- ReadOnlyCollection.cs
- EqualityComparer.cs
- HttpListenerRequestTraceRecord.cs
- Rotation3DKeyFrameCollection.cs
- SetStoryboardSpeedRatio.cs
- BaseResourcesBuildProvider.cs
- Point3DCollectionValueSerializer.cs
- RotateTransform.cs
- ArgumentDirectionHelper.cs
- DataGridViewCellParsingEventArgs.cs
- EmbossBitmapEffect.cs
- EmissiveMaterial.cs
- XmlnsDictionary.cs
- ImageList.cs
- DataSourceControl.cs