Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- UIElementParagraph.cs
- peersecurityelement.cs
- InstanceHandleConflictException.cs
- BinaryConverter.cs
- UpdatePanel.cs
- UseManagedPresentationBindingElement.cs
- CardSpacePolicyElement.cs
- MonitoringDescriptionAttribute.cs
- InputMethod.cs
- AppDomainProtocolHandler.cs
- InternalCache.cs
- XamlFxTrace.cs
- PropertyDescriptorCollection.cs
- Inflater.cs
- XamlFxTrace.cs
- _Rfc2616CacheValidators.cs
- WindowsStatic.cs
- LinqDataSourceEditData.cs
- BulletDecorator.cs
- ThumbButtonInfo.cs
- XmlTextReaderImpl.cs
- RepeaterItem.cs
- Classification.cs
- ViewLoader.cs
- BrushValueSerializer.cs
- TextChangedEventArgs.cs
- DependentList.cs
- MethodMessage.cs
- DataSourceCacheDurationConverter.cs
- OracleConnectionString.cs
- ToolBarButtonClickEvent.cs
- BulletedList.cs
- FlowDocumentReader.cs
- LinkTarget.cs
- HealthMonitoringSectionHelper.cs
- UncommonField.cs
- PersonalizationProviderCollection.cs
- XmlTextEncoder.cs
- XmlTextReaderImplHelpers.cs
- DynamicFilterExpression.cs
- XPathBinder.cs
- Graphics.cs
- SizeChangedEventArgs.cs
- ExpressionEditorSheet.cs
- ActivationServices.cs
- SessionEndedEventArgs.cs
- DesignerCapabilities.cs
- MbpInfo.cs
- DataServiceConfiguration.cs
- StaticTextPointer.cs
- RightNameExpirationInfoPair.cs
- RuntimeArgumentHandle.cs
- AttachedAnnotation.cs
- Rect3DConverter.cs
- EmptyQuery.cs
- StyleSelector.cs
- ItemCollection.cs
- _CacheStreams.cs
- Image.cs
- HScrollProperties.cs
- AccessibleObject.cs
- DataGrid.cs
- JulianCalendar.cs
- TypeReference.cs
- ReflectionTypeLoadException.cs
- ItemsChangedEventArgs.cs
- WSDualHttpSecurityMode.cs
- RelationshipFixer.cs
- ColorContextHelper.cs
- HtmlFormWrapper.cs
- SplitterPanel.cs
- ValueConversionAttribute.cs
- QuaternionAnimation.cs
- DocumentPaginator.cs
- EmulateRecognizeCompletedEventArgs.cs
- ColorConvertedBitmap.cs
- HtmlEmptyTagControlBuilder.cs
- MemberInfoSerializationHolder.cs
- ContentDesigner.cs
- XmlExtensionFunction.cs
- MembershipSection.cs
- RawStylusSystemGestureInputReport.cs
- ImageConverter.cs
- InputScopeAttribute.cs
- ByteBufferPool.cs
- FileLogRecordEnumerator.cs
- AppDomainUnloadedException.cs
- OdbcConnection.cs
- EmptyEnumerator.cs
- RemotingSurrogateSelector.cs
- Attributes.cs
- ManualResetEvent.cs
- UnsafeNativeMethods.cs
- ManagementNamedValueCollection.cs
- InternalPermissions.cs
- ChangeNode.cs
- AbstractSvcMapFileLoader.cs
- BufferedWebEventProvider.cs
- Assembly.cs
- TiffBitmapDecoder.cs