Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewTextBoxColumn.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewSortCompareEventArgs.cs
- DataSourceSelectArguments.cs
- SqlTopReducer.cs
- FullTextState.cs
- SigningCredentials.cs
- FieldTemplateUserControl.cs
- IncrementalCompileAnalyzer.cs
- WrappedIUnknown.cs
- XPathConvert.cs
- ModifierKeysConverter.cs
- JsonFormatGeneratorStatics.cs
- VectorCollectionValueSerializer.cs
- DataGridViewCellValueEventArgs.cs
- EncodingInfo.cs
- TransactionManager.cs
- WorkflowDesignerColors.cs
- NGCSerializerAsync.cs
- OperationResponse.cs
- BaseCodePageEncoding.cs
- XPathCompiler.cs
- ObjectListTitleAttribute.cs
- EdmScalarPropertyAttribute.cs
- Random.cs
- CompatibleIComparer.cs
- FontWeightConverter.cs
- Semaphore.cs
- ADMembershipProvider.cs
- UInt32Storage.cs
- SoapAttributeAttribute.cs
- ConstantExpression.cs
- BooleanKeyFrameCollection.cs
- DataGridViewCellValidatingEventArgs.cs
- ModelItemImpl.cs
- ThicknessAnimation.cs
- XmlSchemaAll.cs
- ComPlusTraceRecord.cs
- ConfigurationStrings.cs
- DependencyPropertyValueSerializer.cs
- HttpApplication.cs
- DataObjectPastingEventArgs.cs
- SystemInformation.cs
- MatcherBuilder.cs
- StylusPlugInCollection.cs
- GenericAuthenticationEventArgs.cs
- StyleHelper.cs
- CodeSnippetTypeMember.cs
- UriExt.cs
- LoginUtil.cs
- EllipseGeometry.cs
- DataGridViewComboBoxEditingControl.cs
- TextFormatterHost.cs
- SpecularMaterial.cs
- ClrPerspective.cs
- MdImport.cs
- ConfigurationStrings.cs
- Registry.cs
- SoapCodeExporter.cs
- TypeSchema.cs
- EncoderExceptionFallback.cs
- Utils.cs
- MessageSmuggler.cs
- XmlSchemaInclude.cs
- DbProviderServices.cs
- CommandBinding.cs
- PersistenceTypeAttribute.cs
- TemplatedMailWebEventProvider.cs
- XmlEntity.cs
- CqlLexer.cs
- XPathNavigator.cs
- MergeEnumerator.cs
- Help.cs
- ToolStripPanel.cs
- EditorPart.cs
- SmtpFailedRecipientException.cs
- ReferenceService.cs
- Message.cs
- StylusPointPropertyInfoDefaults.cs
- PropertyManager.cs
- TableColumn.cs
- ReflectionUtil.cs
- DefaultEventAttribute.cs
- WebRequestModuleElementCollection.cs
- odbcmetadatafactory.cs
- _ProxyChain.cs
- MimePart.cs
- NotFiniteNumberException.cs
- EntityTemplateFactory.cs
- NamespaceList.cs
- ConvertersCollection.cs
- ObjectListItemCollection.cs
- ClearCollection.cs
- Int64AnimationBase.cs
- AssemblyCacheEntry.cs
- TablePatternIdentifiers.cs
- ConnectionManagementSection.cs
- ImageDrawing.cs
- UniqueConstraint.cs
- OutgoingWebRequestContext.cs
- ConsumerConnectionPointCollection.cs
- BaseTemplatedMobileComponentEditor.cs