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
- KeySpline.cs
- SqlBooleanMismatchVisitor.cs
- BaseTemplateCodeDomTreeGenerator.cs
- Typography.cs
- TextEditorSelection.cs
- MetadataArtifactLoaderComposite.cs
- Paragraph.cs
- MaterialCollection.cs
- BaseCollection.cs
- XmlReaderSettings.cs
- CompilerWrapper.cs
- DataGridViewTextBoxEditingControl.cs
- DataError.cs
- DropTarget.cs
- wgx_exports.cs
- WebPartConnectionsCloseVerb.cs
- DataGridViewEditingControlShowingEventArgs.cs
- MouseEvent.cs
- DeclarativeCatalogPart.cs
- WindowsSysHeader.cs
- ScrollData.cs
- DetailsViewRowCollection.cs
- EntityUtil.cs
- SystemUdpStatistics.cs
- SecurityPolicySection.cs
- RepeaterDesigner.cs
- HandlerWithFactory.cs
- CheckBoxBaseAdapter.cs
- Transform.cs
- ReferencedAssembly.cs
- LoginUtil.cs
- EnumerationRangeValidationUtil.cs
- FixedPage.cs
- Root.cs
- LessThan.cs
- ApplyImportsAction.cs
- StructuralCache.cs
- QuaternionConverter.cs
- WebScriptServiceHost.cs
- MaskedTextBoxTextEditor.cs
- CodeDelegateInvokeExpression.cs
- GridItemPattern.cs
- MonitorWrapper.cs
- AccessDataSourceView.cs
- GlobalItem.cs
- ReceiveMessageRecord.cs
- AppDomainProtocolHandler.cs
- InternalBufferManager.cs
- StrongNamePublicKeyBlob.cs
- ErrorTolerantObjectWriter.cs
- GuidelineCollection.cs
- FileChangesMonitor.cs
- UIElementIsland.cs
- IntPtr.cs
- Button.cs
- SqlDataReader.cs
- MarkupExtensionParser.cs
- NetSectionGroup.cs
- HttpListener.cs
- pingexception.cs
- LiteralLink.cs
- AppDomainGrammarProxy.cs
- SamlAuthorizationDecisionClaimResource.cs
- SqlFlattener.cs
- ModuleBuilderData.cs
- DocumentSequenceHighlightLayer.cs
- Suspend.cs
- selecteditemcollection.cs
- PeerNameResolver.cs
- Assert.cs
- IdentityHolder.cs
- ScriptReference.cs
- CodeSnippetExpression.cs
- PreloadHost.cs
- LayoutEvent.cs
- BevelBitmapEffect.cs
- ObjectDataSourceMethodEventArgs.cs
- ExpandSegment.cs
- DetailsViewDeleteEventArgs.cs
- WebBrowserNavigatingEventHandler.cs
- ResXResourceReader.cs
- GraphicsState.cs
- Helpers.cs
- XPathDescendantIterator.cs
- TimeEnumHelper.cs
- TableLayoutPanelBehavior.cs
- HtmlLink.cs
- GridEntryCollection.cs
- SemaphoreFullException.cs
- SystemFonts.cs
- DataGridViewCell.cs
- SwitchLevelAttribute.cs
- Viewport3DAutomationPeer.cs
- TransformerInfo.cs
- ManagementEventWatcher.cs
- securitycriticaldataformultiplegetandset.cs
- ResourceReferenceExpression.cs
- URL.cs
- BinaryFormatter.cs
- ParamArrayAttribute.cs