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
- CfgRule.cs
- OutputScopeManager.cs
- SerialStream.cs
- TableLayoutSettings.cs
- TabControl.cs
- CqlIdentifiers.cs
- CodeRemoveEventStatement.cs
- DSASignatureDeformatter.cs
- MessageLoggingFilterTraceRecord.cs
- GeometryHitTestResult.cs
- VirtualPathUtility.cs
- DataTableNewRowEvent.cs
- MailMessage.cs
- DayRenderEvent.cs
- DataColumnMappingCollection.cs
- DataGridViewBindingCompleteEventArgs.cs
- PlatformNotSupportedException.cs
- KeyGestureConverter.cs
- SQLResource.cs
- RowToParametersTransformer.cs
- ListControl.cs
- UIElementPropertyUndoUnit.cs
- ItemCheckEvent.cs
- StreamWriter.cs
- BufferedReadStream.cs
- SqlRemoveConstantOrderBy.cs
- PropertyPushdownHelper.cs
- DatagridviewDisplayedBandsData.cs
- PropertyEmitter.cs
- SqlClientMetaDataCollectionNames.cs
- CommandBinding.cs
- WebPartUserCapability.cs
- EntityDataSourceWrapper.cs
- SiteMapPath.cs
- XMLSyntaxException.cs
- RadioButtonBaseAdapter.cs
- EndPoint.cs
- ScriptComponentDescriptor.cs
- MimeMultiPart.cs
- CustomExpressionEventArgs.cs
- TextFormatterHost.cs
- AstTree.cs
- Table.cs
- TableSectionStyle.cs
- OutputCacheModule.cs
- MethodImplAttribute.cs
- GeneralTransformGroup.cs
- CompareInfo.cs
- SqlInternalConnection.cs
- DocumentGridContextMenu.cs
- HealthMonitoringSection.cs
- HtmlAnchor.cs
- CriticalHandle.cs
- SafeHandles.cs
- NaturalLanguageHyphenator.cs
- Style.cs
- HotSpotCollection.cs
- HtmlEmptyTagControlBuilder.cs
- MouseEvent.cs
- HttpException.cs
- CircleEase.cs
- NonParentingControl.cs
- NameTable.cs
- NullRuntimeConfig.cs
- MetadataCache.cs
- ContentTypeSettingDispatchMessageFormatter.cs
- ThreadPool.cs
- ObjectDataSourceView.cs
- ArcSegment.cs
- XmlWellformedWriter.cs
- TextElementCollection.cs
- Misc.cs
- DynamicPropertyHolder.cs
- DbConnectionPoolCounters.cs
- ProcessThread.cs
- CancelEventArgs.cs
- PrintDialog.cs
- XmlSchemaAll.cs
- ItemList.cs
- TraceSection.cs
- ProxyManager.cs
- ToolStripItem.cs
- UpdateManifestForBrowserApplication.cs
- HelpInfo.cs
- PairComparer.cs
- HttpContextServiceHost.cs
- BinaryMethodMessage.cs
- TimeZone.cs
- MediaPlayer.cs
- WebDisplayNameAttribute.cs
- RecordConverter.cs
- WindowsPrincipal.cs
- GridViewRowEventArgs.cs
- ScriptManager.cs
- ImageListUtils.cs
- SerialReceived.cs
- PortCache.cs
- BStrWrapper.cs
- DataGridRowEventArgs.cs
- HtmlString.cs