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
- Privilege.cs
- DataServiceRequest.cs
- Package.cs
- PointLightBase.cs
- ExpressionWriter.cs
- TypeConverter.cs
- EarlyBoundInfo.cs
- ScriptIgnoreAttribute.cs
- SectionVisual.cs
- WebPartEditorOkVerb.cs
- ControlType.cs
- SynchronizationLockException.cs
- CheckPair.cs
- TileBrush.cs
- CryptoKeySecurity.cs
- SQLDouble.cs
- ThreadAbortException.cs
- InkSerializer.cs
- CharAnimationBase.cs
- FontCollection.cs
- DataListItemEventArgs.cs
- WindowsRichEditRange.cs
- ZoomComboBox.cs
- DesignerEventService.cs
- ColumnClickEvent.cs
- MergablePropertyAttribute.cs
- BitmapCodecInfo.cs
- ItemAutomationPeer.cs
- BinaryMessageEncodingElement.cs
- MessageSecurityVersion.cs
- EmptyEnumerator.cs
- AlphaSortedEnumConverter.cs
- QilReplaceVisitor.cs
- GeneralTransform3D.cs
- DesignerForm.cs
- DataGridViewRowEventArgs.cs
- PLINQETWProvider.cs
- WindowsListBox.cs
- WebPartZoneBase.cs
- NeutralResourcesLanguageAttribute.cs
- NotifyIcon.cs
- ColumnWidthChangingEvent.cs
- ExpressionsCollectionConverter.cs
- IsolatedStorageFilePermission.cs
- SqlEnums.cs
- AppDomainProtocolHandler.cs
- ListSortDescription.cs
- ValueTypeFixupInfo.cs
- StateElement.cs
- DbConnectionStringBuilder.cs
- TextElement.cs
- Label.cs
- AttachmentService.cs
- CqlQuery.cs
- TextTreeTextElementNode.cs
- LineGeometry.cs
- DesignerActionListCollection.cs
- SymbolMethod.cs
- CachedRequestParams.cs
- AssemblyAssociatedContentFileAttribute.cs
- CreateUserWizardAutoFormat.cs
- CalendarItem.cs
- IdentifierCollection.cs
- SafeBitVector32.cs
- IndexingContentUnit.cs
- SystemIPInterfaceStatistics.cs
- ServerProtocol.cs
- SystemDropShadowChrome.cs
- CodeTypeOfExpression.cs
- FontSourceCollection.cs
- ThreadAttributes.cs
- ConditionCollection.cs
- filewebrequest.cs
- WorkflowInstance.cs
- InstanceKeyCompleteException.cs
- XmlSchemaSimpleContentExtension.cs
- TabletCollection.cs
- SerializationSectionGroup.cs
- DirectoryObjectSecurity.cs
- CodeDomLocalizationProvider.cs
- Soap12ServerProtocol.cs
- BaseCollection.cs
- ImageClickEventArgs.cs
- CmsInterop.cs
- CryptoStream.cs
- SecurityState.cs
- HandledEventArgs.cs
- ActivityPreviewDesigner.cs
- WebConfigurationHostFileChange.cs
- SqlDataSource.cs
- DataBindingCollection.cs
- SafeUserTokenHandle.cs
- IDQuery.cs
- Type.cs
- PropertyFilterAttribute.cs
- ColorConvertedBitmap.cs
- RefType.cs
- TableCellCollection.cs
- RegexWorker.cs
- DataGridViewTopRowAccessibleObject.cs