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
- DataGridSortCommandEventArgs.cs
- RegexCharClass.cs
- COAUTHINFO.cs
- CheckBoxAutomationPeer.cs
- Int32KeyFrameCollection.cs
- OrCondition.cs
- GridViewPageEventArgs.cs
- CustomAttribute.cs
- PixelFormats.cs
- LayoutEngine.cs
- UpdateTracker.cs
- DataGridViewSortCompareEventArgs.cs
- DateTimeConverter2.cs
- login.cs
- Function.cs
- CommandField.cs
- PropertyMapper.cs
- DataGridViewTopRowAccessibleObject.cs
- CodeNamespaceImportCollection.cs
- HasRunnableWorkflowEvent.cs
- AbstractDataSvcMapFileLoader.cs
- XmlAttribute.cs
- DataGridTableCollection.cs
- TextEditorSpelling.cs
- PathSegment.cs
- CompositeDataBoundControl.cs
- RandomDelaySendsAsyncResult.cs
- securitycriticaldataformultiplegetandset.cs
- ReturnEventArgs.cs
- XpsDigitalSignature.cs
- CompiledIdentityConstraint.cs
- ParseHttpDate.cs
- CommandBinding.cs
- SchemaObjectWriter.cs
- CallbackHandler.cs
- typedescriptorpermissionattribute.cs
- IconEditor.cs
- WinFormsUtils.cs
- BamlResourceDeserializer.cs
- ProfileModule.cs
- DataErrorValidationRule.cs
- NavigationEventArgs.cs
- DefaultValueConverter.cs
- Localizer.cs
- ResourceReferenceKeyNotFoundException.cs
- SqlDataSourceCache.cs
- CodeDirectoryCompiler.cs
- DataSysAttribute.cs
- ExtensionFile.cs
- RelativeSource.cs
- DBSqlParserTable.cs
- TextViewDesigner.cs
- ErrorWrapper.cs
- DrawingAttributesDefaultValueFactory.cs
- BasicExpandProvider.cs
- VersionedStreamOwner.cs
- WmlImageAdapter.cs
- DynamicQueryStringParameter.cs
- M3DUtil.cs
- CultureSpecificCharacterBufferRange.cs
- MediaCommands.cs
- XPathCompileException.cs
- BCryptHashAlgorithm.cs
- PenLineCapValidation.cs
- Base64Stream.cs
- SqlNamer.cs
- DeploymentSection.cs
- TypedLocationWrapper.cs
- TreeBuilderXamlTranslator.cs
- SqlAggregateChecker.cs
- CounterCreationDataCollection.cs
- ApplicationInfo.cs
- X509Certificate.cs
- DbConnectionPoolCounters.cs
- IssuedTokenParametersEndpointAddressElement.cs
- WebPartsPersonalizationAuthorization.cs
- datacache.cs
- XmlSignatureManifest.cs
- AuthenticationConfig.cs
- SecUtil.cs
- FrameworkObject.cs
- EntityException.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- DetailsViewRow.cs
- CreateDataSourceDialog.cs
- TextureBrush.cs
- RepeatBehaviorConverter.cs
- FormsAuthenticationUserCollection.cs
- FixedSOMPageElement.cs
- SecurityResources.cs
- BrowserCapabilitiesCodeGenerator.cs
- WindowsEditBox.cs
- XdrBuilder.cs
- EndCreateSecurityTokenRequest.cs
- StringFreezingAttribute.cs
- Sequence.cs
- DragDropManager.cs
- CapabilitiesPattern.cs
- DataGridCommandEventArgs.cs
- SmtpNegotiateAuthenticationModule.cs