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
- MultipartContentParser.cs
- XmlDigitalSignatureProcessor.cs
- CompilerScope.Storage.cs
- ConstructorBuilder.cs
- Error.cs
- ContextStack.cs
- MemberHolder.cs
- SkinIDTypeConverter.cs
- SchemaImporterExtensionElementCollection.cs
- DataGridViewCheckBoxCell.cs
- BrowserDefinitionCollection.cs
- SymmetricKeyWrap.cs
- BitmapSourceSafeMILHandle.cs
- BufferedGraphics.cs
- RadioButtonPopupAdapter.cs
- ErrorWebPart.cs
- TypeConverterHelper.cs
- StyleXamlParser.cs
- TypeConverter.cs
- CmsInterop.cs
- TextTreeFixupNode.cs
- Int32Rect.cs
- FontEditor.cs
- OleDbRowUpdatingEvent.cs
- DriveInfo.cs
- TextBlock.cs
- JoinTreeSlot.cs
- MessagePartDescription.cs
- DataFieldConverter.cs
- WebPartMenu.cs
- CodeAccessSecurityEngine.cs
- DrawingImage.cs
- ValidationSummary.cs
- RtfControls.cs
- CatalogZoneBase.cs
- wgx_exports.cs
- EntityParameter.cs
- LayoutSettings.cs
- RemoveStoryboard.cs
- CodeSubDirectoriesCollection.cs
- SecurityDescriptor.cs
- UnSafeCharBuffer.cs
- ParamArrayAttribute.cs
- BaseInfoTable.cs
- WhitespaceRule.cs
- XPathNodeInfoAtom.cs
- embossbitmapeffect.cs
- GeometryGroup.cs
- Exceptions.cs
- DataMemberFieldConverter.cs
- ColorConvertedBitmap.cs
- ConfigXmlReader.cs
- RC2.cs
- XmlQueryOutput.cs
- ClientConfigPaths.cs
- UTF7Encoding.cs
- IDReferencePropertyAttribute.cs
- ResXDataNode.cs
- WebErrorHandler.cs
- Line.cs
- XmlConvert.cs
- MenuItemAutomationPeer.cs
- WebMessageEncoderFactory.cs
- Scripts.cs
- Int16KeyFrameCollection.cs
- ValidationRule.cs
- GlobalizationSection.cs
- HttpHandlerAction.cs
- String.cs
- StackOverflowException.cs
- CanonicalXml.cs
- ColorConverter.cs
- DSASignatureDeformatter.cs
- EditorZoneBase.cs
- CheckBoxField.cs
- MultiBinding.cs
- xmlsaver.cs
- PeerValidationBehavior.cs
- ToolStripSystemRenderer.cs
- Tag.cs
- HuffModule.cs
- DropDownButton.cs
- GatewayIPAddressInformationCollection.cs
- AppModelKnownContentFactory.cs
- IProvider.cs
- DataSourceSelectArguments.cs
- EditorPartCollection.cs
- PnrpPeerResolver.cs
- ProgressPage.cs
- X509Utils.cs
- BaseParser.cs
- MaskedTextBoxTextEditor.cs
- DrawListViewSubItemEventArgs.cs
- PropertyGeneratedEventArgs.cs
- BadImageFormatException.cs
- AmbiguousMatchException.cs
- ExecutionContext.cs
- DataView.cs
- ByteStack.cs
- PrivilegeNotHeldException.cs