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
- SHA256Cng.cs
- PropertyNames.cs
- BindingMemberInfo.cs
- RsaSecurityKey.cs
- SafeBitVector32.cs
- TabControlEvent.cs
- CardSpaceShim.cs
- _UriTypeConverter.cs
- RewritingSimplifier.cs
- EnumerableValidator.cs
- BitSet.cs
- RoleManagerSection.cs
- StackSpiller.Generated.cs
- ReturnValue.cs
- _PooledStream.cs
- IPAddressCollection.cs
- PinnedBufferMemoryStream.cs
- DiscriminatorMap.cs
- SignatureToken.cs
- SimpleType.cs
- KeyedHashAlgorithm.cs
- MiniAssembly.cs
- UriTemplatePathSegment.cs
- RemoteWebConfigurationHostStream.cs
- MethodBody.cs
- WindowsToolbarItemAsMenuItem.cs
- PasswordBox.cs
- FtpWebRequest.cs
- OverrideMode.cs
- BuilderPropertyEntry.cs
- AssertSection.cs
- Expander.cs
- TemplateKey.cs
- WebDisplayNameAttribute.cs
- SponsorHelper.cs
- ClientProtocol.cs
- DebuggerService.cs
- EntityProxyTypeInfo.cs
- Deflater.cs
- CalculatedColumn.cs
- DeferredSelectedIndexReference.cs
- XmlToDatasetMap.cs
- X509Chain.cs
- TreeNodeBindingCollection.cs
- PtsPage.cs
- ScrollChangedEventArgs.cs
- EmptyCollection.cs
- ParallelEnumerableWrapper.cs
- SelectionListDesigner.cs
- SecurityUtils.cs
- KeyToListMap.cs
- LinqDataSourceSelectEventArgs.cs
- SafeRightsManagementEnvironmentHandle.cs
- OperationGenerator.cs
- FieldValue.cs
- HtmlTableRowCollection.cs
- DataGridViewDataConnection.cs
- ToolStrip.cs
- TextRangeSerialization.cs
- UTF8Encoding.cs
- CodeCompileUnit.cs
- OrCondition.cs
- SQLString.cs
- UnionExpr.cs
- DirectoryObjectSecurity.cs
- SqlParameter.cs
- ComponentRenameEvent.cs
- ColumnMapTranslator.cs
- SqlCommandBuilder.cs
- Behavior.cs
- ManagedWndProcTracker.cs
- AuthenticationService.cs
- RotateTransform.cs
- COAUTHIDENTITY.cs
- DatagridviewDisplayedBandsData.cs
- DecimalKeyFrameCollection.cs
- ObjectAnimationBase.cs
- Matrix3DValueSerializer.cs
- HttpWebResponse.cs
- TypeExtension.cs
- XamlPointCollectionSerializer.cs
- OdbcInfoMessageEvent.cs
- HorizontalAlignConverter.cs
- UnmanagedHandle.cs
- NativeMethods.cs
- ThreadExceptionDialog.cs
- ScriptingProfileServiceSection.cs
- BitmapFrame.cs
- XmlDesigner.cs
- HwndStylusInputProvider.cs
- AppDomainProtocolHandler.cs
- SerializationFieldInfo.cs
- COM2TypeInfoProcessor.cs
- ServiceParser.cs
- FileDialog.cs
- ProcessInfo.cs
- UserPersonalizationStateInfo.cs
- SessionState.cs
- NativeCompoundFileAPIs.cs
- CodeGenHelper.cs