Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewCellConverter.cs / 1 / 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
- GridViewHeaderRowPresenterAutomationPeer.cs
- CompletionBookmark.cs
- ImageInfo.cs
- InfoCardCryptoHelper.cs
- ExecutedRoutedEventArgs.cs
- AnnotationResource.cs
- DateTimePicker.cs
- listviewsubitemcollectioneditor.cs
- MobileTemplatedControlDesigner.cs
- _Connection.cs
- DataFormats.cs
- SafeNativeMethods.cs
- BitVector32.cs
- PropertyTabChangedEvent.cs
- Psha1DerivedKeyGenerator.cs
- NumberSubstitution.cs
- StringToken.cs
- WebPartDeleteVerb.cs
- TokenBasedSetEnumerator.cs
- DbProviderSpecificTypePropertyAttribute.cs
- AssemblyFilter.cs
- QueryStringParameter.cs
- XD.cs
- EncryptedData.cs
- CurrentChangingEventArgs.cs
- wmiprovider.cs
- GlyphElement.cs
- DataGridViewIntLinkedList.cs
- XmlNamedNodeMap.cs
- AnnotationService.cs
- SourceSwitch.cs
- BitArray.cs
- Pointer.cs
- SiteMapHierarchicalDataSourceView.cs
- designeractionlistschangedeventargs.cs
- CoreSwitches.cs
- AccessViolationException.cs
- XamlTreeBuilderBamlRecordWriter.cs
- ManualResetEvent.cs
- RequestQueryParser.cs
- InternalConfirm.cs
- GenericTypeParameterBuilder.cs
- FrameworkTextComposition.cs
- ScrollProviderWrapper.cs
- AtlasWeb.Designer.cs
- DataBinder.cs
- DataGrid.cs
- ServiceDescriptionReflector.cs
- CryptoStream.cs
- Point3DCollectionConverter.cs
- FormsIdentity.cs
- dbenumerator.cs
- ObjectDataSourceEventArgs.cs
- HttpRequest.cs
- SQLDouble.cs
- SqlProfileProvider.cs
- DurableMessageDispatchInspector.cs
- CompiledQueryCacheKey.cs
- FtpWebResponse.cs
- TypeToArgumentTypeConverter.cs
- DataControlButton.cs
- AccessedThroughPropertyAttribute.cs
- CalculatedColumn.cs
- HttpCacheVaryByContentEncodings.cs
- InputLanguageProfileNotifySink.cs
- Int16Storage.cs
- FontSourceCollection.cs
- WindowPattern.cs
- OpenTypeLayout.cs
- ImageFormat.cs
- StringValueConverter.cs
- GenerateTemporaryTargetAssembly.cs
- LocalizableAttribute.cs
- MinMaxParagraphWidth.cs
- BlockCollection.cs
- ObjectSecurity.cs
- FreezableOperations.cs
- SpotLight.cs
- XmlSchemaAnnotation.cs
- ProviderSettingsCollection.cs
- DependencyPropertyChangedEventArgs.cs
- TextPenaltyModule.cs
- EdmScalarPropertyAttribute.cs
- Message.cs
- ModelItemCollectionImpl.cs
- FileDialogPermission.cs
- FixedSOMPage.cs
- FixedPageStructure.cs
- ToolTip.cs
- ReflectionHelper.cs
- TdsValueSetter.cs
- NotImplementedException.cs
- MimeMapping.cs
- ProfileInfo.cs
- GridErrorDlg.cs
- Visual3DCollection.cs
- Buffer.cs
- CatalogZoneBase.cs
- BitmapEffectState.cs
- PropertyGrid.cs