Code:
/ FX-1434 / FX-1434 / 1.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
- BasicHttpBindingCollectionElement.cs
- LineProperties.cs
- XPathNodeInfoAtom.cs
- IdentifierService.cs
- StreamInfo.cs
- ContextProperty.cs
- DecimalAnimationUsingKeyFrames.cs
- BindingContext.cs
- Command.cs
- PrintControllerWithStatusDialog.cs
- TabPage.cs
- PropertyCollection.cs
- ProxyHwnd.cs
- _HeaderInfoTable.cs
- EventDescriptor.cs
- PlaceHolder.cs
- PasswordTextContainer.cs
- SynchronousChannelMergeEnumerator.cs
- oledbconnectionstring.cs
- LinkLabel.cs
- InvalidDocumentContentsException.cs
- TextCompositionEventArgs.cs
- DataPagerField.cs
- parserscommon.cs
- _Events.cs
- LabelLiteral.cs
- ListBoxItemAutomationPeer.cs
- AliasGenerator.cs
- Span.cs
- SerializationHelper.cs
- UpDownBase.cs
- AppLevelCompilationSectionCache.cs
- ProfileManager.cs
- IndexedString.cs
- SQlBooleanStorage.cs
- KeyProperty.cs
- IfAction.cs
- EntityDataSourceView.cs
- Stackframe.cs
- DrawingImage.cs
- ObjectNavigationPropertyMapping.cs
- RawUIStateInputReport.cs
- AlphabetConverter.cs
- InvocationExpression.cs
- FontDialog.cs
- SoundPlayer.cs
- SchemaImporterExtensionElement.cs
- IConvertible.cs
- HostedAspNetEnvironment.cs
- HandleValueEditor.cs
- Trace.cs
- DataServiceResponse.cs
- WinInetCache.cs
- PowerModeChangedEventArgs.cs
- ServiceManagerHandle.cs
- ItemsPresenter.cs
- XmlStringTable.cs
- UrlPropertyAttribute.cs
- ExtendedProperty.cs
- FormViewModeEventArgs.cs
- HttpCapabilitiesBase.cs
- RegexCaptureCollection.cs
- EntityDataSourceChangingEventArgs.cs
- HostProtectionPermission.cs
- EditorPartCollection.cs
- MatrixTransform.cs
- _OverlappedAsyncResult.cs
- TabItemAutomationPeer.cs
- OdbcEnvironment.cs
- MatrixUtil.cs
- XMLUtil.cs
- TypeSystem.cs
- Debug.cs
- AgileSafeNativeMemoryHandle.cs
- DBCommand.cs
- DNS.cs
- DriveNotFoundException.cs
- DecoderReplacementFallback.cs
- SSmlParser.cs
- __Error.cs
- StringFunctions.cs
- BindingListCollectionView.cs
- ElementProxy.cs
- InternalMappingException.cs
- DecoderReplacementFallback.cs
- ObjectDataSourceEventArgs.cs
- ElapsedEventArgs.cs
- TableCellAutomationPeer.cs
- SqlParameterCollection.cs
- PartBasedPackageProperties.cs
- DotAtomReader.cs
- IisTraceListener.cs
- Buffer.cs
- UpdatePanelControlTrigger.cs
- HttpCapabilitiesBase.cs
- DataGridCell.cs
- RegexGroup.cs
- WindowsTab.cs
- ExpressionEvaluator.cs
- DSACryptoServiceProvider.cs