Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ // // 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
- ClonableStack.cs
- SqlTopReducer.cs
- TrackingDataItem.cs
- NameTable.cs
- ComponentResourceKeyConverter.cs
- ClientTarget.cs
- OracleParameter.cs
- KerberosRequestorSecurityToken.cs
- MouseActionValueSerializer.cs
- QueryModel.cs
- CommandManager.cs
- ReadingWritingEntityEventArgs.cs
- ValidatorCompatibilityHelper.cs
- StreamReader.cs
- ObjectAnimationUsingKeyFrames.cs
- EntityParameter.cs
- altserialization.cs
- CommandExpr.cs
- TimeSpanValidatorAttribute.cs
- TreeNodeStyleCollection.cs
- AutomationElementCollection.cs
- HttpCookie.cs
- SqlClientWrapperSmiStream.cs
- Tuple.cs
- MasterPageCodeDomTreeGenerator.cs
- MachineKeyConverter.cs
- FtpWebRequest.cs
- MemberExpression.cs
- fixedPageContentExtractor.cs
- Console.cs
- ControlParameter.cs
- ComplexBindingPropertiesAttribute.cs
- AuthenticateEventArgs.cs
- ArrayEditor.cs
- TimeZone.cs
- EditingCommands.cs
- HexParser.cs
- UpdateCommand.cs
- ScrollBar.cs
- CryptoConfig.cs
- StrongNameUtility.cs
- unitconverter.cs
- Flattener.cs
- InputScopeConverter.cs
- SmtpTransport.cs
- DataServiceHost.cs
- ConfigurationLocationCollection.cs
- X509CertificateChain.cs
- PropertyValueChangedEvent.cs
- AsyncOperationManager.cs
- HttpSessionStateBase.cs
- SqlMethods.cs
- RowParagraph.cs
- HtmlControlDesigner.cs
- UrlMappingCollection.cs
- HotSpot.cs
- KeyEvent.cs
- XmlValidatingReader.cs
- PagerSettings.cs
- arc.cs
- UnsafeNativeMethodsPenimc.cs
- ObjectDataSourceMethodEventArgs.cs
- PageEventArgs.cs
- IndexedWhereQueryOperator.cs
- PrivateFontCollection.cs
- PenLineCapValidation.cs
- CommentGlyph.cs
- FastEncoder.cs
- InkCollectionBehavior.cs
- QilInvokeLateBound.cs
- ToolStripStatusLabel.cs
- TextEffect.cs
- CmsInterop.cs
- TracingConnectionInitiator.cs
- CreateUserWizardStep.cs
- Calendar.cs
- MergablePropertyAttribute.cs
- TableLayout.cs
- TimeSpanValidator.cs
- StringUtil.cs
- QuaternionConverter.cs
- HelpFileFileNameEditor.cs
- Win32Exception.cs
- DataSetFieldSchema.cs
- ReflectionPermission.cs
- IsolatedStorageException.cs
- VariableQuery.cs
- SplitContainerDesigner.cs
- EventsTab.cs
- GeneratedCodeAttribute.cs
- AssemblyBuilder.cs
- ReadOnlyDataSource.cs
- LicenseProviderAttribute.cs
- Binding.cs
- RecordManager.cs
- DrawingGroup.cs
- ActivityExecutorOperation.cs
- TypeEnumerableViewSchema.cs
- CngKeyCreationParameters.cs
- storepermission.cs