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
- Task.cs
- PopupRoot.cs
- EntityConnection.cs
- DetailsViewPageEventArgs.cs
- MarkupWriter.cs
- ConstraintManager.cs
- DeflateStreamAsyncResult.cs
- XmlSignatureManifest.cs
- ObjectListField.cs
- StaticSiteMapProvider.cs
- SingleObjectCollection.cs
- DictionaryKeyPropertyAttribute.cs
- CodePrimitiveExpression.cs
- Fx.cs
- SqlUserDefinedAggregateAttribute.cs
- Point3D.cs
- TreeViewBindingsEditor.cs
- UpdatePanelTriggerCollection.cs
- TextContainerChangedEventArgs.cs
- LinearGradientBrush.cs
- DataGrid.cs
- XmlNodeComparer.cs
- EnumerableRowCollection.cs
- linebase.cs
- CapabilitiesRule.cs
- KeyboardNavigation.cs
- ParameterCollectionEditor.cs
- SecurityDocument.cs
- FacetValueContainer.cs
- DesignerHelpers.cs
- cryptoapiTransform.cs
- LinkUtilities.cs
- Viewport2DVisual3D.cs
- DataSysAttribute.cs
- Icon.cs
- ProtocolsConfiguration.cs
- SqlTriggerContext.cs
- PersonalizationState.cs
- DeferredElementTreeState.cs
- CompositeCollection.cs
- X509Chain.cs
- WindowsIdentity.cs
- FreeFormPanel.cs
- WSSecurityTokenSerializer.cs
- Misc.cs
- Run.cs
- TableAutomationPeer.cs
- CorePropertiesFilter.cs
- QEncodedStream.cs
- ScrollBarAutomationPeer.cs
- TextServicesLoader.cs
- SafePipeHandle.cs
- MouseGestureConverter.cs
- OledbConnectionStringbuilder.cs
- SslSecurityTokenParameters.cs
- DataSourceCacheDurationConverter.cs
- EmbeddedMailObjectsCollection.cs
- _SingleItemRequestCache.cs
- OracleParameter.cs
- HttpStreamFormatter.cs
- XmlNode.cs
- HtmlInputSubmit.cs
- EntityDataSourceStatementEditor.cs
- RandomNumberGenerator.cs
- LayoutTableCell.cs
- GridViewUpdateEventArgs.cs
- filewebrequest.cs
- OverflowException.cs
- IItemProperties.cs
- CatalogPart.cs
- xsdvalidator.cs
- ServicePointManagerElement.cs
- ImageField.cs
- recordstatescratchpad.cs
- SHA512Managed.cs
- EncodingDataItem.cs
- HttpResponse.cs
- SystemEvents.cs
- CompoundFileStreamReference.cs
- ToolStripGrip.cs
- Size.cs
- ToolStripMenuItem.cs
- WindowsHyperlink.cs
- SmtpFailedRecipientsException.cs
- CollectionViewSource.cs
- SiblingIterators.cs
- ClientTarget.cs
- XamlSerializerUtil.cs
- MessageBox.cs
- DataTableMapping.cs
- WebPartDescriptionCollection.cs
- DelayedRegex.cs
- WebEventTraceProvider.cs
- DispatcherHooks.cs
- XmlILStorageConverter.cs
- QueryContinueDragEventArgs.cs
- ImportContext.cs
- LinkUtilities.cs
- DataServiceQueryContinuation.cs
- OutOfProcStateClientManager.cs