Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- TextRange.cs
- DateTimeUtil.cs
- keycontainerpermission.cs
- InkCanvas.cs
- CompositeScriptReferenceEventArgs.cs
- CqlLexer.cs
- SetStoryboardSpeedRatio.cs
- RangeValidator.cs
- ServiceNameElementCollection.cs
- PageStatePersister.cs
- HtmlMobileTextWriter.cs
- IndexedSelectQueryOperator.cs
- UrlAuthFailureHandler.cs
- MappingSource.cs
- ProcessHost.cs
- shaperfactoryquerycachekey.cs
- BuildDependencySet.cs
- XmlChildNodes.cs
- DynamicPropertyHolder.cs
- ListControlConvertEventArgs.cs
- SessionStateItemCollection.cs
- DictionaryGlobals.cs
- HttpWebResponse.cs
- LinearGradientBrush.cs
- BufferedResponseStream.cs
- VBIdentifierDesigner.xaml.cs
- SAPIEngineTypes.cs
- ProcessInputEventArgs.cs
- MatrixAnimationUsingKeyFrames.cs
- AddInContractAttribute.cs
- InstanceHandleReference.cs
- DebugHandleTracker.cs
- HostingMessageProperty.cs
- WindowsBrush.cs
- StrokeDescriptor.cs
- Variable.cs
- UserNameSecurityTokenProvider.cs
- SQLBytes.cs
- AliasedExpr.cs
- PDBReader.cs
- XmlCodeExporter.cs
- SelectionPattern.cs
- _LazyAsyncResult.cs
- HttpFileCollectionWrapper.cs
- StringComparer.cs
- ClosableStream.cs
- Touch.cs
- Send.cs
- CacheDependency.cs
- MessagePartDescription.cs
- DataAdapter.cs
- ToolStripProgressBar.cs
- SymDocumentType.cs
- ClosableStream.cs
- TransformedBitmap.cs
- GridViewSortEventArgs.cs
- DataControlButton.cs
- BitmapPalette.cs
- ScriptingProfileServiceSection.cs
- ValidatingReaderNodeData.cs
- TypedReference.cs
- ReceiveSecurityHeaderElementManager.cs
- SqlCommandSet.cs
- InvokeMethodActivity.cs
- WeakEventTable.cs
- LifetimeServices.cs
- XmlSchemaAppInfo.cs
- HtmlTableCell.cs
- COM2PropertyDescriptor.cs
- Image.cs
- DataList.cs
- PtsHost.cs
- Socket.cs
- SqlHelper.cs
- DynamicDiscoveryDocument.cs
- TextParagraph.cs
- UnsafeNativeMethodsCLR.cs
- SqlCacheDependencySection.cs
- Token.cs
- RemoteCryptoRsaServiceProvider.cs
- WindowsFormsHostAutomationPeer.cs
- ParameterCollectionEditorForm.cs
- TransformedBitmap.cs
- BindableTemplateBuilder.cs
- ComponentResourceKey.cs
- RenderCapability.cs
- DrawingContextDrawingContextWalker.cs
- ECDiffieHellman.cs
- BitmapEffectState.cs
- OracleParameterCollection.cs
- SQLMembershipProvider.cs
- Setter.cs
- PreviewPageInfo.cs
- ContextMarshalException.cs
- OSFeature.cs
- XhtmlBasicPanelAdapter.cs
- CalendarDataBindingHandler.cs
- Pkcs7Signer.cs
- XpsDocument.cs
- NoClickablePointException.cs