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
- HtmlInputFile.cs
- GridViewActionList.cs
- SpanIndex.cs
- TableLayoutPanel.cs
- IsolatedStorageFilePermission.cs
- URLMembershipCondition.cs
- SHA1CryptoServiceProvider.cs
- AuthenticationException.cs
- DBCSCodePageEncoding.cs
- SelectionRangeConverter.cs
- DeobfuscatingStream.cs
- __TransparentProxy.cs
- QuaternionAnimationUsingKeyFrames.cs
- TableColumn.cs
- DataGridViewAccessibleObject.cs
- DataGridTextBoxColumn.cs
- UnsafeNativeMethods.cs
- GridViewPageEventArgs.cs
- DataSourceSerializationException.cs
- ProofTokenCryptoHandle.cs
- ImageSource.cs
- PermissionToken.cs
- SqlUserDefinedTypeAttribute.cs
- ViewCellSlot.cs
- SimpleTextLine.cs
- XmlSignatureManifest.cs
- HwndSourceKeyboardInputSite.cs
- PropVariant.cs
- InputReportEventArgs.cs
- XamlSerializer.cs
- InputBinding.cs
- GridSplitterAutomationPeer.cs
- MethodRental.cs
- SvcMapFileSerializer.cs
- TrailingSpaceComparer.cs
- PixelShader.cs
- UnknownBitmapEncoder.cs
- NetNamedPipeBindingElement.cs
- GeneralTransform2DTo3D.cs
- InvokeWebService.cs
- ImmComposition.cs
- LocalizationComments.cs
- Hashtable.cs
- WebPartDescriptionCollection.cs
- MemoryMappedView.cs
- TriState.cs
- MultipleViewPattern.cs
- BooleanToVisibilityConverter.cs
- ConnectionPoint.cs
- DefaultHttpHandler.cs
- Pkcs9Attribute.cs
- TableLayoutSettingsTypeConverter.cs
- ListViewInsertedEventArgs.cs
- Argument.cs
- ProtocolElement.cs
- FixedDocument.cs
- RecipientIdentity.cs
- SamlSubject.cs
- Authorization.cs
- InputProviderSite.cs
- OdbcFactory.cs
- DbProviderFactoriesConfigurationHandler.cs
- WebAdminConfigurationHelper.cs
- CopyNamespacesAction.cs
- DefaultSection.cs
- GenericWebPart.cs
- ExclusiveCanonicalizationTransform.cs
- Membership.cs
- StrokeNodeOperations2.cs
- TypeConverterAttribute.cs
- Token.cs
- FirstMatchCodeGroup.cs
- ArgumentNullException.cs
- ColumnPropertiesGroup.cs
- XmlElementAttributes.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- CodeExporter.cs
- TargetParameterCountException.cs
- DynamicScriptObject.cs
- ColumnMapCopier.cs
- SelectionGlyph.cs
- Authorization.cs
- AttributeExtensions.cs
- TemplateAction.cs
- DrawingGroup.cs
- LogEntry.cs
- SchemaImporter.cs
- XmlSchemaSimpleContentExtension.cs
- LinkDesigner.cs
- FormattedTextSymbols.cs
- Duration.cs
- CompositionTarget.cs
- SignatureHelper.cs
- TablePatternIdentifiers.cs
- IgnorePropertiesAttribute.cs
- TaskForm.cs
- IdleTimeoutMonitor.cs
- LineVisual.cs
- NameNode.cs
- NamedElement.cs