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
- UIElementAutomationPeer.cs
- EventSetter.cs
- StructuralObject.cs
- XPathChildIterator.cs
- KeyboardDevice.cs
- TdsEnums.cs
- ArrayElementGridEntry.cs
- TextHintingModeValidation.cs
- CLSCompliantAttribute.cs
- Accessible.cs
- DrawListViewItemEventArgs.cs
- AsyncCompletedEventArgs.cs
- ParallelTimeline.cs
- SQLCharsStorage.cs
- Paragraph.cs
- ListViewItem.cs
- CompositeActivityMarkupSerializer.cs
- Journal.cs
- StatusBarDrawItemEvent.cs
- UInt32Storage.cs
- ButtonColumn.cs
- WindowsGrip.cs
- GPStream.cs
- ResourceExpressionBuilder.cs
- ServiceNameCollection.cs
- StrongNameIdentityPermission.cs
- PolyBezierSegment.cs
- XmlSchemaCollection.cs
- QilBinary.cs
- ImageListStreamer.cs
- MDIControlStrip.cs
- SQLInt32Storage.cs
- ControlUtil.cs
- PinnedBufferMemoryStream.cs
- NumberAction.cs
- Clipboard.cs
- __Filters.cs
- XPathBuilder.cs
- ExternalFile.cs
- ProcessThread.cs
- WebContext.cs
- VScrollProperties.cs
- AssemblyName.cs
- TextTreeUndo.cs
- ViewBox.cs
- ReferencedType.cs
- PromptStyle.cs
- TableItemPatternIdentifiers.cs
- StylusLogic.cs
- FunctionQuery.cs
- TranslateTransform.cs
- CacheForPrimitiveTypes.cs
- DataGridViewRow.cs
- Registry.cs
- MeshGeometry3D.cs
- CounterSample.cs
- DataGridViewRowCollection.cs
- FixedFindEngine.cs
- TextServicesProperty.cs
- WindowsSolidBrush.cs
- VisualStyleElement.cs
- ComponentDispatcherThread.cs
- AdobeCFFWrapper.cs
- SettingsSection.cs
- HtmlInputRadioButton.cs
- DistinctQueryOperator.cs
- xdrvalidator.cs
- PtsCache.cs
- AutomationPropertyInfo.cs
- ItemChangedEventArgs.cs
- InputScopeManager.cs
- PrtCap_Reader.cs
- DecoderFallback.cs
- SystemIPInterfaceProperties.cs
- ToolboxSnapDragDropEventArgs.cs
- InternalConfigSettingsFactory.cs
- GatewayIPAddressInformationCollection.cs
- X509PeerCertificateAuthenticationElement.cs
- SourceElementsCollection.cs
- ParallelTimeline.cs
- ItemsControlAutomationPeer.cs
- MembershipValidatePasswordEventArgs.cs
- AssertSection.cs
- iisPickupDirectory.cs
- CapabilitiesRule.cs
- ThreadStateException.cs
- RootDesignerSerializerAttribute.cs
- ServerIdentity.cs
- SqlMetaData.cs
- DeploymentSectionCache.cs
- TextFormatterHost.cs
- EventlogProvider.cs
- HMACRIPEMD160.cs
- EntryPointNotFoundException.cs
- ListViewGroupCollectionEditor.cs
- GridItemProviderWrapper.cs
- Geometry3D.cs
- ElementProxy.cs
- _NegotiateClient.cs
- ObjectListSelectEventArgs.cs