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
- DocumentSchemaValidator.cs
- transactioncontext.cs
- ComponentDispatcherThread.cs
- SoapTypeAttribute.cs
- SecurityRuntime.cs
- DataBinder.cs
- securitycriticaldataformultiplegetandset.cs
- FormViewUpdateEventArgs.cs
- ToolStripItemCollection.cs
- DataObject.cs
- ExtensionDataObject.cs
- RelatedCurrencyManager.cs
- SHA384CryptoServiceProvider.cs
- DataSpaceManager.cs
- TemplateParser.cs
- GiveFeedbackEvent.cs
- ToolStripPanelSelectionBehavior.cs
- _SslStream.cs
- CapabilitiesPattern.cs
- TypeContext.cs
- TextInfo.cs
- rsa.cs
- SqlCacheDependencySection.cs
- EditorPartCollection.cs
- VariableAction.cs
- Stopwatch.cs
- SvcFileManager.cs
- MemberHolder.cs
- DataBoundControlDesigner.cs
- FixedTextContainer.cs
- ProxyRpc.cs
- ActivityMarkupSerializer.cs
- RegexGroupCollection.cs
- EditingScope.cs
- BitStack.cs
- EventLogStatus.cs
- VersionedStreamOwner.cs
- SaveLedgerEntryRequest.cs
- HttpCookie.cs
- CodeAttributeDeclarationCollection.cs
- ParameterBuilder.cs
- ExtensionSimplifierMarkupObject.cs
- Comparer.cs
- StructuredType.cs
- IOThreadTimer.cs
- StructuredTypeInfo.cs
- EnlistmentTraceIdentifier.cs
- DocumentApplication.cs
- TextParentUndoUnit.cs
- FieldDescriptor.cs
- MessageQueueEnumerator.cs
- StylusTip.cs
- IDQuery.cs
- ComponentChangingEvent.cs
- PreservationFileWriter.cs
- IdentityValidationException.cs
- UIntPtr.cs
- PlacementWorkspace.cs
- ToggleButton.cs
- TextParentUndoUnit.cs
- ChtmlPageAdapter.cs
- BitmapImage.cs
- WorkflowDesignerColors.cs
- DebugView.cs
- ProgressBar.cs
- BaseTemplateBuildProvider.cs
- SqlBulkCopyColumnMapping.cs
- WorkflowMessageEventArgs.cs
- SelectionEditor.cs
- DirtyTextRange.cs
- Int32Converter.cs
- CodeMethodMap.cs
- SupportsPreviewControlAttribute.cs
- TemplatedMailWebEventProvider.cs
- XmlCharCheckingWriter.cs
- DbConnectionClosed.cs
- TextBoxDesigner.cs
- PointIndependentAnimationStorage.cs
- SqlCommandSet.cs
- AutomationElementIdentifiers.cs
- TypeDescriptorContext.cs
- CreateRefExpr.cs
- IssuedTokenServiceElement.cs
- RewritingValidator.cs
- StringUtil.cs
- ViewBase.cs
- ObjectSet.cs
- WhitespaceSignificantCollectionAttribute.cs
- InvalidDataContractException.cs
- Rules.cs
- ResourceDictionary.cs
- ClientTargetCollection.cs
- ServiceReference.cs
- GetPageNumberCompletedEventArgs.cs
- _ListenerResponseStream.cs
- SequenceFullException.cs
- SqlMultiplexer.cs
- IndependentlyAnimatedPropertyMetadata.cs
- HotCommands.cs
- StateMachineWorkflowDesigner.cs