Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- GeneralTransform3DGroup.cs
- ListView.cs
- SerializableAttribute.cs
- QilGenerator.cs
- MasterPageBuildProvider.cs
- ExceptionRoutedEventArgs.cs
- MultilineStringConverter.cs
- TreeNodeEventArgs.cs
- DataGridLinkButton.cs
- SqlUnionizer.cs
- BinHexDecoder.cs
- MessageQueuePermission.cs
- GPPOINT.cs
- PrimaryKeyTypeConverter.cs
- ToolStripDropTargetManager.cs
- XmlAttributeCollection.cs
- WeakReference.cs
- ValidateNames.cs
- WebHttpDispatchOperationSelectorData.cs
- MetaDataInfo.cs
- ListBoxItemWrapperAutomationPeer.cs
- Command.cs
- COM2Enum.cs
- RuntimeIdentifierPropertyAttribute.cs
- recordstate.cs
- CrossSiteScriptingValidation.cs
- webproxy.cs
- BuildDependencySet.cs
- ClientData.cs
- UpdateProgress.cs
- PageCodeDomTreeGenerator.cs
- QueryableFilterRepeater.cs
- AsyncStreamReader.cs
- DataObjectEventArgs.cs
- DataGridViewLinkColumn.cs
- SamlAssertion.cs
- EnumerableRowCollectionExtensions.cs
- EnumMemberAttribute.cs
- DetailsViewActionList.cs
- ProjectionPlanCompiler.cs
- ProcessThreadCollection.cs
- TCEAdapterGenerator.cs
- SoapObjectWriter.cs
- DataGridRowsPresenter.cs
- CookieProtection.cs
- DataMemberFieldEditor.cs
- TdsParser.cs
- PartialCachingAttribute.cs
- Journal.cs
- HostExecutionContextManager.cs
- AutomationEventArgs.cs
- KeyFrames.cs
- SoapAttributeAttribute.cs
- TableColumnCollection.cs
- GatewayDefinition.cs
- CellQuery.cs
- xmlglyphRunInfo.cs
- ReadonlyMessageFilter.cs
- TrackingMemoryStream.cs
- KnownIds.cs
- CookieHandler.cs
- HttpCacheVary.cs
- XmlSerializerSection.cs
- XPathSingletonIterator.cs
- DocumentViewerAutomationPeer.cs
- StylusCollection.cs
- UTF8Encoding.cs
- CheckBox.cs
- CultureInfoConverter.cs
- SqlFileStream.cs
- Mutex.cs
- DoubleCollectionValueSerializer.cs
- EventRoute.cs
- ResourceProperty.cs
- QueryConverter.cs
- MenuItemBindingCollection.cs
- DBConnectionString.cs
- ActivationArguments.cs
- RemotingException.cs
- HyperlinkAutomationPeer.cs
- QilIterator.cs
- ListViewItemSelectionChangedEvent.cs
- ContentType.cs
- TextTreeObjectNode.cs
- ProxyElement.cs
- TextCharacters.cs
- EntityDescriptor.cs
- InkSerializer.cs
- ProjectedSlot.cs
- TextEditorThreadLocalStore.cs
- SelectedCellsCollection.cs
- XomlCompilerError.cs
- StopRoutingHandler.cs
- ModelItemCollection.cs
- QueueNameHelper.cs
- FontStretches.cs
- FileDialogCustomPlacesCollection.cs
- SecurityHelper.cs
- KerberosReceiverSecurityToken.cs
- CompatibleIComparer.cs