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
- ProvidersHelper.cs
- Identity.cs
- ToolStripComboBox.cs
- AttributeExtensions.cs
- XPathBinder.cs
- Point3DConverter.cs
- NonParentingControl.cs
- GACMembershipCondition.cs
- ContentValidator.cs
- PrintController.cs
- XmlQueryContext.cs
- EntityKeyElement.cs
- DesignerMetadata.cs
- XmlStringTable.cs
- MutableAssemblyCacheEntry.cs
- XmlComment.cs
- RequestQueryParser.cs
- SymDocumentType.cs
- ContentDisposition.cs
- KnownColorTable.cs
- XmlIncludeAttribute.cs
- ProxyElement.cs
- StylusEditingBehavior.cs
- EntityType.cs
- ComponentFactoryHelpers.cs
- FunctionGenerator.cs
- HwndTarget.cs
- Transform3D.cs
- _Connection.cs
- dsa.cs
- ActiveXSite.cs
- SID.cs
- ObjectQueryExecutionPlan.cs
- GenericTypeParameterBuilder.cs
- LambdaCompiler.Address.cs
- TextBox.cs
- MarkerProperties.cs
- InputScopeAttribute.cs
- CopyNodeSetAction.cs
- CriticalHandle.cs
- SearchExpression.cs
- GridItemProviderWrapper.cs
- StyleXamlParser.cs
- SapiRecognizer.cs
- DocumentViewerAutomationPeer.cs
- ProfileGroupSettingsCollection.cs
- FragmentNavigationEventArgs.cs
- ToolStripContainer.cs
- MatrixTransform.cs
- DbMetaDataFactory.cs
- ContextMenu.cs
- ResponseBodyWriter.cs
- FormatConvertedBitmap.cs
- CodeIterationStatement.cs
- QuotedPrintableStream.cs
- SqlConnectionHelper.cs
- SafeEventLogWriteHandle.cs
- MemberMaps.cs
- MediaTimeline.cs
- DataGridViewRowConverter.cs
- HandledEventArgs.cs
- DataRowChangeEvent.cs
- HandoffBehavior.cs
- CodeComment.cs
- OleDbReferenceCollection.cs
- VariableDesigner.xaml.cs
- Transform.cs
- PreloadedPackages.cs
- ReaderWriterLockSlim.cs
- VirtualizedItemProviderWrapper.cs
- ApplicationDirectory.cs
- RadioButtonList.cs
- ResourcePermissionBaseEntry.cs
- AnnotationResource.cs
- ThreadExceptionEvent.cs
- VirtualPathProvider.cs
- CryptoApi.cs
- HandlerFactoryCache.cs
- DefaultHttpHandler.cs
- SerializerDescriptor.cs
- DataServiceProcessingPipeline.cs
- InstanceDataCollection.cs
- SecurityElement.cs
- ManageRequest.cs
- LinqDataSourceHelper.cs
- SimplePropertyEntry.cs
- DebugHandleTracker.cs
- ThreadInterruptedException.cs
- TypeDescriptor.cs
- VersionedStream.cs
- RenderDataDrawingContext.cs
- BStrWrapper.cs
- SystemColorTracker.cs
- FunctionDescription.cs
- PointLightBase.cs
- PropertyBuilder.cs
- ObjectTag.cs
- MailAddressCollection.cs
- DeadCharTextComposition.cs
- oledbmetadatacollectionnames.cs