Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ZoneIdentityPermission.cs
- SessionEndingEventArgs.cs
- ValidationErrorCollection.cs
- XmlDataProvider.cs
- DataBindingCollection.cs
- MetadataHelper.cs
- ExecutedRoutedEventArgs.cs
- Math.cs
- ContextStack.cs
- ArglessEventHandlerProxy.cs
- SerTrace.cs
- regiisutil.cs
- UnwrappedTypesXmlSerializerManager.cs
- CompositeDesignerAccessibleObject.cs
- ConfigXmlDocument.cs
- Variant.cs
- QuadraticEase.cs
- ToolStripGripRenderEventArgs.cs
- SmiGettersStream.cs
- HTMLTagNameToTypeMapper.cs
- sqlmetadatafactory.cs
- ITextView.cs
- SourceFileInfo.cs
- AnnotationAdorner.cs
- CodeDelegateInvokeExpression.cs
- DataServiceQueryOfT.cs
- ImportOptions.cs
- DataBindingHandlerAttribute.cs
- Transactions.cs
- TextWriterEngine.cs
- WebBaseEventKeyComparer.cs
- WaitForChangedResult.cs
- DoubleLink.cs
- SafeFileMappingHandle.cs
- PeerInvitationResponse.cs
- FileDialogCustomPlace.cs
- DynamicDataRoute.cs
- RadioButtonDesigner.cs
- NoneExcludedImageIndexConverter.cs
- DbTypeMap.cs
- Camera.cs
- RemoteCryptoRsaServiceProvider.cs
- XmlTypeAttribute.cs
- MimeAnyImporter.cs
- Journaling.cs
- OracleSqlParser.cs
- OutputCacheSettingsSection.cs
- RoleManagerModule.cs
- GuidelineSet.cs
- CompositeCollectionView.cs
- MarshalByRefObject.cs
- MsmqHostedTransportConfiguration.cs
- AttributeQuery.cs
- DocumentReference.cs
- SuppressMessageAttribute.cs
- MexHttpsBindingCollectionElement.cs
- Ipv6Element.cs
- AssemblySettingAttributes.cs
- ToolStripTemplateNode.cs
- CacheEntry.cs
- HtmlEmptyTagControlBuilder.cs
- DialogWindow.cs
- Expression.DebuggerProxy.cs
- SimpleTypeResolver.cs
- BasicHttpSecurity.cs
- QueryContinueDragEvent.cs
- ComponentDispatcherThread.cs
- SessionStateUtil.cs
- CFStream.cs
- OutputCacheProfile.cs
- ProfileGroupSettingsCollection.cs
- Assert.cs
- UriTemplateHelpers.cs
- TextBox.cs
- ValueUtilsSmi.cs
- ConfigurationPermission.cs
- TypedReference.cs
- RuleSetBrowserDialog.cs
- CheckBoxStandardAdapter.cs
- _SslStream.cs
- AssemblyInfo.cs
- ArgumentsParser.cs
- SqlDependencyUtils.cs
- Parser.cs
- WaitHandle.cs
- XmlLinkedNode.cs
- FontResourceCache.cs
- Point3DAnimationUsingKeyFrames.cs
- FormViewModeEventArgs.cs
- ObjectDataSourceStatusEventArgs.cs
- Utils.cs
- Console.cs
- SchemaComplexType.cs
- EmptyControlCollection.cs
- HWStack.cs
- DbFunctionCommandTree.cs
- TokenizerHelper.cs
- GeometryHitTestResult.cs
- CookielessData.cs
- StringWriter.cs