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
- RegexParser.cs
- PagerSettings.cs
- ExpressionLink.cs
- Font.cs
- IIS7UserPrincipal.cs
- RotationValidation.cs
- SQLBoolean.cs
- SimpleModelProvider.cs
- PackageDocument.cs
- DSASignatureDeformatter.cs
- ObjectDesignerDataSourceView.cs
- ParserOptions.cs
- MediaTimeline.cs
- TextMarkerSource.cs
- StickyNote.cs
- TextSelectionHighlightLayer.cs
- IntegerValidatorAttribute.cs
- SqlDataSourceCustomCommandEditor.cs
- StringSorter.cs
- DataServiceClientException.cs
- CqlBlock.cs
- IdleTimeoutMonitor.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- TransportManager.cs
- DSACryptoServiceProvider.cs
- WorkflowInstanceProvider.cs
- ObjectStateFormatter.cs
- Win32Exception.cs
- ArcSegment.cs
- OdbcConnectionPoolProviderInfo.cs
- MultiViewDesigner.cs
- DetailsViewModeEventArgs.cs
- PrintDialogException.cs
- BooleanKeyFrameCollection.cs
- XmlValidatingReaderImpl.cs
- ControlPropertyNameConverter.cs
- CancelEventArgs.cs
- GroupJoinQueryOperator.cs
- QueryStringParameter.cs
- DataGridCellEditEndingEventArgs.cs
- PointCollection.cs
- FaultReason.cs
- ClrProviderManifest.cs
- PageRanges.cs
- MetadataItemEmitter.cs
- SoapEnumAttribute.cs
- ClientUrlResolverWrapper.cs
- Drawing.cs
- DataList.cs
- TreeNodeBinding.cs
- OutputCacheSection.cs
- ClockGroup.cs
- SessionPageStatePersister.cs
- OptimizedTemplateContentHelper.cs
- UnSafeCharBuffer.cs
- EdmEntityTypeAttribute.cs
- DBNull.cs
- WebAdminConfigurationHelper.cs
- ButtonChrome.cs
- HyperLinkDesigner.cs
- ConditionalAttribute.cs
- ParameterRefs.cs
- TagPrefixCollection.cs
- _SslStream.cs
- CompilerWrapper.cs
- _KerberosClient.cs
- LocalizableResourceBuilder.cs
- InfoCardSchemas.cs
- GeometryModel3D.cs
- ExtendedTransformFactory.cs
- TrustManagerMoreInformation.cs
- PersonalizationProviderCollection.cs
- AuthStoreRoleProvider.cs
- TimeZoneNotFoundException.cs
- DataViewManager.cs
- AdjustableArrowCap.cs
- PageAsyncTask.cs
- FileLoadException.cs
- RoutedEventValueSerializer.cs
- RequestCacheManager.cs
- AccessDataSourceView.cs
- ObjectConverter.cs
- PageTheme.cs
- UriPrefixTable.cs
- TypeSystem.cs
- WebConvert.cs
- LogicalMethodInfo.cs
- GridViewDeletedEventArgs.cs
- ReferentialConstraint.cs
- StringUtil.cs
- WeakKeyDictionary.cs
- Queue.cs
- GPRECTF.cs
- XamlPathDataSerializer.cs
- XslTransform.cs
- ExtensionQuery.cs
- TextElement.cs
- SqlDataAdapter.cs
- CodeSubDirectoriesCollection.cs
- DataChangedEventManager.cs