Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewCellConverter.cs / 1305376 / DataGridViewCellConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.Windows.Forms; using System.Globalization; using System.ComponentModel; using System.Reflection; using System.Runtime.Serialization.Formatters; using System.ComponentModel.Design.Serialization; // used by the designer to serialize the DataGridViewCell class internal class DataGridViewCellConverter : ExpandableObjectConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } DataGridViewCell cell = value as DataGridViewCell; if (destinationType == typeof(InstanceDescriptor) && cell != null) { ConstructorInfo ctor = cell.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. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.Windows.Forms; using System.Globalization; using System.ComponentModel; using System.Reflection; using System.Runtime.Serialization.Formatters; using System.ComponentModel.Design.Serialization; // used by the designer to serialize the DataGridViewCell class internal class DataGridViewCellConverter : ExpandableObjectConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } DataGridViewCell cell = value as DataGridViewCell; if (destinationType == typeof(InstanceDescriptor) && cell != null) { ConstructorInfo ctor = cell.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
- DebugView.cs
- CacheSection.cs
- Graphics.cs
- DataFormats.cs
- Pkcs9Attribute.cs
- ToolboxItemFilterAttribute.cs
- KoreanCalendar.cs
- ValidatorCompatibilityHelper.cs
- NullExtension.cs
- NumericUpDownAccelerationCollection.cs
- SimpleRecyclingCache.cs
- SizeFConverter.cs
- CellLabel.cs
- Int64Animation.cs
- TdsParserSafeHandles.cs
- EventsTab.cs
- EntityContainerAssociationSetEnd.cs
- Renderer.cs
- NativeMethods.cs
- TreeViewEvent.cs
- SelectionUIService.cs
- XPathSelfQuery.cs
- ApplicationManager.cs
- ServiceBehaviorAttribute.cs
- ReadOnlyDataSourceView.cs
- NativeMethods.cs
- CodePropertyReferenceExpression.cs
- ObsoleteAttribute.cs
- SignerInfo.cs
- CommandValueSerializer.cs
- SessionStateContainer.cs
- MediaCommands.cs
- DataGridViewCellPaintingEventArgs.cs
- Image.cs
- TypeReference.cs
- CodeCompiler.cs
- AssemblyAttributes.cs
- Attributes.cs
- Wizard.cs
- RequestValidator.cs
- SoapSchemaImporter.cs
- ComplusTypeValidator.cs
- GraphicsState.cs
- BindStream.cs
- IDReferencePropertyAttribute.cs
- BoundPropertyEntry.cs
- CodeChecksumPragma.cs
- OleDbParameterCollection.cs
- MasterPageBuildProvider.cs
- ErrorFormatterPage.cs
- ToolBar.cs
- LayoutTable.cs
- SubpageParagraph.cs
- ConfigurationManagerHelper.cs
- HtmlInputButton.cs
- SynchronousChannel.cs
- DataGridToolTip.cs
- DataGridCellEditEndingEventArgs.cs
- XmlCountingReader.cs
- CodeAttributeArgumentCollection.cs
- HtmlInputHidden.cs
- XmlSerializationWriter.cs
- WebServiceHandler.cs
- TraceXPathNavigator.cs
- XmlIterators.cs
- OutputCacheSettingsSection.cs
- SurrogateSelector.cs
- PenThread.cs
- PropertyMapper.cs
- WindowsTokenRoleProvider.cs
- IconBitmapDecoder.cs
- BufferedStream2.cs
- Semaphore.cs
- ModulesEntry.cs
- GroupBox.cs
- Int32.cs
- XPathQueryGenerator.cs
- BamlLocalizableResourceKey.cs
- OverrideMode.cs
- VectorAnimationUsingKeyFrames.cs
- CustomCredentialPolicy.cs
- CompilationLock.cs
- SystemKeyConverter.cs
- DefaultProxySection.cs
- OdbcConnectionFactory.cs
- FocusManager.cs
- CapabilitiesState.cs
- SqlConnection.cs
- ServerValidateEventArgs.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ZipIOCentralDirectoryBlock.cs
- GridViewPageEventArgs.cs
- UnsafeNativeMethods.cs
- TextDecoration.cs
- PageThemeCodeDomTreeGenerator.cs
- ObjectSet.cs
- PrimitiveXmlSerializers.cs
- DisableDpiAwarenessAttribute.cs
- WindowsRichEdit.cs
- Sql8ExpressionRewriter.cs