Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- _NetworkingPerfCounters.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- TargetControlTypeCache.cs
- HttpContext.cs
- WorkflowEventArgs.cs
- MetadataHelper.cs
- COAUTHINFO.cs
- RawKeyboardInputReport.cs
- ScriptHandlerFactory.cs
- NameNode.cs
- QilParameter.cs
- Triangle.cs
- PropertyNames.cs
- BamlResourceContent.cs
- ConsumerConnectionPoint.cs
- counter.cs
- ComNativeDescriptor.cs
- XslTransform.cs
- DynamicResourceExtensionConverter.cs
- RangeBaseAutomationPeer.cs
- StateManagedCollection.cs
- ActivitySurrogateSelector.cs
- _IPv6Address.cs
- DataRelation.cs
- ProgressiveCrcCalculatingStream.cs
- ItemCollection.cs
- DATA_BLOB.cs
- ToolStripMenuItem.cs
- CommandDevice.cs
- RequestValidator.cs
- OleDbMetaDataFactory.cs
- FixedTextBuilder.cs
- VerificationAttribute.cs
- WinEventTracker.cs
- ConstraintManager.cs
- _Events.cs
- DataGridViewCellLinkedList.cs
- HatchBrush.cs
- ComponentCommands.cs
- XmlQualifiedName.cs
- LineGeometry.cs
- DictionarySectionHandler.cs
- UshortList2.cs
- COM2IProvidePropertyBuilderHandler.cs
- LoginName.cs
- Matrix3DValueSerializer.cs
- Process.cs
- NonBatchDirectoryCompiler.cs
- Interlocked.cs
- PolicyChain.cs
- DataGridViewSelectedCellCollection.cs
- DiagnosticTrace.cs
- CompiledXpathExpr.cs
- LinqDataSourceValidationException.cs
- AnnotationObservableCollection.cs
- AppModelKnownContentFactory.cs
- ResponseStream.cs
- KeyToListMap.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ReaderWriterLockWrapper.cs
- Processor.cs
- SafeArrayRankMismatchException.cs
- FixedLineResult.cs
- DockingAttribute.cs
- ZoneLinkButton.cs
- ResourceExpressionBuilder.cs
- ReferencedAssembly.cs
- DesignDataSource.cs
- GeometryConverter.cs
- ScriptIgnoreAttribute.cs
- X509CertificateValidationMode.cs
- TcpWorkerProcess.cs
- DataServiceClientException.cs
- ValuePattern.cs
- TextTreeRootNode.cs
- WebPartVerb.cs
- OdbcPermission.cs
- DesignerRegionMouseEventArgs.cs
- BindingMAnagerBase.cs
- PropertyGeneratedEventArgs.cs
- TextEditorCopyPaste.cs
- SerialStream.cs
- Merger.cs
- ComponentResourceKeyConverter.cs
- TextSpan.cs
- SimpleWebHandlerParser.cs
- TextReader.cs
- HostedTransportConfigurationBase.cs
- InternalRelationshipCollection.cs
- DependencyPropertyAttribute.cs
- SessionPageStateSection.cs
- OpCodes.cs
- QueryGenerator.cs
- XmlToDatasetMap.cs
- GridViewCellAutomationPeer.cs
- DataTable.cs
- CommandEventArgs.cs
- ValueChangedEventManager.cs
- DataGridViewCellEventArgs.cs
- AspNetCompatibilityRequirementsAttribute.cs