Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewColumnConverter.cs / 1 / DataGridViewColumnConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Drawing; using System.Diagnostics; using System.Globalization; using System.Reflection; internal class DataGridViewColumnConverter : ExpandableObjectConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination /// type is string. If this cannot convert to the desitnation type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } DataGridViewColumn dataGridViewColumn = value as DataGridViewColumn; if (destinationType == typeof(InstanceDescriptor) && dataGridViewColumn != null) { ConstructorInfo ctor; // public DataGridViewColumn(Type cellType) // if (dataGridViewColumn.CellType != null) { ctor = dataGridViewColumn.GetType().GetConstructor(new Type[] { typeof(Type) }); if (ctor != null) { return new InstanceDescriptor(ctor, new object[] { dataGridViewColumn.CellType }, false); } } // public DataGridViewColumn() // ctor = dataGridViewColumn.GetType().GetConstructor(new Type[0]); if (ctor != null) { return new InstanceDescriptor(ctor, new object[0], false); } } return base.ConvertTo(context, culture, value, destinationType); } } } // 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
- ReliableSession.cs
- _ScatterGatherBuffers.cs
- CaseInsensitiveComparer.cs
- TextBoxBase.cs
- DoubleLinkListEnumerator.cs
- ControlPropertyNameConverter.cs
- Main.cs
- DebugHandleTracker.cs
- Attribute.cs
- ResourceDisplayNameAttribute.cs
- ButtonBase.cs
- _SafeNetHandles.cs
- Types.cs
- TerminateSequence.cs
- ResourceAttributes.cs
- SudsCommon.cs
- UrlAuthFailedErrorFormatter.cs
- ProfileGroupSettingsCollection.cs
- smtpconnection.cs
- OpenFileDialog.cs
- HtmlHead.cs
- EnumCodeDomSerializer.cs
- AsyncCompletedEventArgs.cs
- LiteralLink.cs
- OpCopier.cs
- XPathDocumentBuilder.cs
- PageContentCollection.cs
- IOException.cs
- HttpConfigurationContext.cs
- GridView.cs
- _FixedSizeReader.cs
- AutoResetEvent.cs
- OleDbRowUpdatedEvent.cs
- UserMapPath.cs
- AutoResetEvent.cs
- AlternationConverter.cs
- LabelDesigner.cs
- PolicyStatement.cs
- TrustLevel.cs
- SafePEFileHandle.cs
- SystemGatewayIPAddressInformation.cs
- _Events.cs
- RadioButtonRenderer.cs
- ImportContext.cs
- SignatureResourceHelper.cs
- WebPartConnectionsDisconnectVerb.cs
- ManagementEventArgs.cs
- InternalUserCancelledException.cs
- Utility.cs
- FormDocumentDesigner.cs
- Tuple.cs
- CompilationRelaxations.cs
- TemplatedMailWebEventProvider.cs
- TableHeaderCell.cs
- PrinterResolution.cs
- ParallelRangeManager.cs
- XmlWrappingReader.cs
- GPRECTF.cs
- Crypto.cs
- ObjectStateEntry.cs
- ToolStripLabel.cs
- ParameterCollection.cs
- StringStorage.cs
- UserInitiatedNavigationPermission.cs
- DbTransaction.cs
- IndexedEnumerable.cs
- DataGridCellsPanel.cs
- GridViewAutomationPeer.cs
- AppSettingsReader.cs
- TransformedBitmap.cs
- ProxyHwnd.cs
- CharAnimationUsingKeyFrames.cs
- EventLogPermissionAttribute.cs
- NumericUpDownAcceleration.cs
- CounterSampleCalculator.cs
- Deflater.cs
- XmlNotation.cs
- LifetimeServices.cs
- DataSourceListEditor.cs
- DefaultParameterValueAttribute.cs
- ListViewItemMouseHoverEvent.cs
- HttpHandlerAction.cs
- TextTreeRootNode.cs
- RemotingSurrogateSelector.cs
- XmlNodeList.cs
- Int16AnimationUsingKeyFrames.cs
- RemoteArgument.cs
- CompiledIdentityConstraint.cs
- PageHandlerFactory.cs
- ObjectTag.cs
- ProcessActivityTreeOptions.cs
- SymLanguageVendor.cs
- TimersDescriptionAttribute.cs
- FaultHandlingFilter.cs
- WebControlToolBoxItem.cs
- HuffmanTree.cs
- ConnectionPointCookie.cs
- ToolStripCodeDomSerializer.cs
- MatrixStack.cs
- WSHttpBindingBaseElement.cs