Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SoapMessage.cs
- MemberInitExpression.cs
- PropertyEmitter.cs
- BitmapMetadataEnumerator.cs
- ListViewDesigner.cs
- TreeView.cs
- ProfilePropertySettingsCollection.cs
- Formatter.cs
- Message.cs
- AddInEnvironment.cs
- TreeNodeEventArgs.cs
- Geometry3D.cs
- ExpressionBinding.cs
- FileAuthorizationModule.cs
- Privilege.cs
- Closure.cs
- RoutingEndpointTrait.cs
- DataFormats.cs
- ModelServiceImpl.cs
- SafeHandle.cs
- SimpleApplicationHost.cs
- ChildTable.cs
- WindowsIdentity.cs
- XmlSchemaValidator.cs
- ObjectDataSourceView.cs
- PixelFormatConverter.cs
- WindowsButton.cs
- ColumnPropertiesGroup.cs
- _StreamFramer.cs
- SQLUtility.cs
- Mappings.cs
- HttpCapabilitiesBase.cs
- SwitchElementsCollection.cs
- DBParameter.cs
- ProcessStartInfo.cs
- MeshGeometry3D.cs
- NativeMethodsCLR.cs
- SafeMemoryMappedFileHandle.cs
- EventLog.cs
- BindingEntityInfo.cs
- IdentityNotMappedException.cs
- EpmContentSerializer.cs
- DataViewSettingCollection.cs
- ProviderIncompatibleException.cs
- DataGridViewColumnHeaderCell.cs
- FileLogRecordEnumerator.cs
- AssemblyCache.cs
- EDesignUtil.cs
- RectAnimationBase.cs
- AnimationStorage.cs
- StreamReader.cs
- DesignerView.Commands.cs
- CodeMemberEvent.cs
- RegistryDataKey.cs
- ServiceInstanceProvider.cs
- ToolStripSeparatorRenderEventArgs.cs
- reliableinputsessionchannel.cs
- sitestring.cs
- PngBitmapEncoder.cs
- ListView.cs
- SerializeAbsoluteContext.cs
- CharacterHit.cs
- Formatter.cs
- FrameSecurityDescriptor.cs
- WebServiceMethodData.cs
- SystemGatewayIPAddressInformation.cs
- ContentElement.cs
- DataGridViewCellMouseEventArgs.cs
- BinaryMethodMessage.cs
- SecuritySessionSecurityTokenAuthenticator.cs
- ToolboxItemFilterAttribute.cs
- ValueUtilsSmi.cs
- HwndStylusInputProvider.cs
- NotImplementedException.cs
- InputScopeConverter.cs
- EventHandlingScope.cs
- DataKeyArray.cs
- XsltQilFactory.cs
- EffectiveValueEntry.cs
- TrustLevelCollection.cs
- RowToParametersTransformer.cs
- Parsers.cs
- ChannelRequirements.cs
- UserControlAutomationPeer.cs
- M3DUtil.cs
- CLSCompliantAttribute.cs
- MarkupCompiler.cs
- cache.cs
- RSAOAEPKeyExchangeDeformatter.cs
- StrongNameUtility.cs
- SelectionProviderWrapper.cs
- MulticastOption.cs
- ListBindingConverter.cs
- MemoryPressure.cs
- LabelLiteral.cs
- Operator.cs
- ScrollBar.cs
- baseaxisquery.cs
- OutputCacheSettings.cs
- DataObjectMethodAttribute.cs