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
- ConfigurationPermission.cs
- GlyphRunDrawing.cs
- ModelItemDictionaryImpl.cs
- System.Data.OracleClient_BID.cs
- ConstructorBuilder.cs
- SqlCacheDependencyDatabaseCollection.cs
- HttpHandlerAction.cs
- DictionaryBase.cs
- DataKey.cs
- TaskFileService.cs
- RuleInfoComparer.cs
- HtmlPageAdapter.cs
- NamespaceCollection.cs
- ToolStripGripRenderEventArgs.cs
- LongCountAggregationOperator.cs
- Knowncolors.cs
- HttpCapabilitiesEvaluator.cs
- DesignerTransactionCloseEvent.cs
- BaseCodePageEncoding.cs
- TypedTableBaseExtensions.cs
- MessageRpc.cs
- CheckBoxList.cs
- TextBoxView.cs
- XamlVector3DCollectionSerializer.cs
- sqlpipe.cs
- XmlLangPropertyAttribute.cs
- XmlAttribute.cs
- figurelength.cs
- CommonDialog.cs
- AnonymousIdentificationModule.cs
- ProfileGroupSettings.cs
- DefaultTraceListener.cs
- SiteMapNode.cs
- TreeNode.cs
- ProgressiveCrcCalculatingStream.cs
- Evaluator.cs
- Line.cs
- ValueExpressions.cs
- ConfigurationManagerInternal.cs
- Options.cs
- Int32.cs
- TokenizerHelper.cs
- ChannelToken.cs
- GridViewRowCollection.cs
- EntityWithKeyStrategy.cs
- CheckBoxAutomationPeer.cs
- DesignerTransaction.cs
- Metafile.cs
- AtomEntry.cs
- SymbolTable.cs
- SmtpReplyReader.cs
- DefaultBinder.cs
- MsmqException.cs
- ThreadStateException.cs
- XmlSchemaObjectTable.cs
- DataSourceHelper.cs
- _ScatterGatherBuffers.cs
- SelectionList.cs
- SystemException.cs
- HtmlListAdapter.cs
- Debugger.cs
- ToolboxItemAttribute.cs
- TraceSource.cs
- FtpWebRequest.cs
- ExtensionFile.cs
- QuaternionRotation3D.cs
- FixedPageAutomationPeer.cs
- TextRenderingModeValidation.cs
- FilterRepeater.cs
- XsltArgumentList.cs
- HttpResponse.cs
- PageSettings.cs
- StringArrayConverter.cs
- RawStylusSystemGestureInputReport.cs
- DBSchemaTable.cs
- DrawingGroup.cs
- QueryOutputWriterV1.cs
- ListItemParagraph.cs
- SizeConverter.cs
- XMLDiffLoader.cs
- CodeAttributeArgumentCollection.cs
- HealthMonitoringSectionHelper.cs
- WebPartDescriptionCollection.cs
- CaseInsensitiveOrdinalStringComparer.cs
- AutoResizedEvent.cs
- RowSpanVector.cs
- Connector.cs
- DataGridViewLinkCell.cs
- HttpDebugHandler.cs
- BufferedStream.cs
- BufferModesCollection.cs
- CodeTypeReferenceExpression.cs
- Comparer.cs
- StatusBarDesigner.cs
- HeaderCollection.cs
- GetPageNumberCompletedEventArgs.cs
- _NtlmClient.cs
- QueryHandler.cs
- BuilderElements.cs
- ProcessHostMapPath.cs