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
- XmlStreamStore.cs
- TypeConverter.cs
- MetabaseServerConfig.cs
- TextServicesDisplayAttribute.cs
- DesignerView.Commands.cs
- ProfessionalColorTable.cs
- ConfigurationLockCollection.cs
- ToggleButtonAutomationPeer.cs
- _LocalDataStoreMgr.cs
- HMACRIPEMD160.cs
- TypeListConverter.cs
- DocumentSequenceHighlightLayer.cs
- MDIControlStrip.cs
- ByteStream.cs
- QilTypeChecker.cs
- DataGridViewRowConverter.cs
- ByteViewer.cs
- RangeEnumerable.cs
- ToolBarOverflowPanel.cs
- UiaCoreApi.cs
- PointLight.cs
- SessionMode.cs
- DoubleCollection.cs
- coordinatorfactory.cs
- ParenthesizePropertyNameAttribute.cs
- TTSEngineProxy.cs
- XPathPatternBuilder.cs
- SiblingIterators.cs
- CodeCompileUnit.cs
- WebPartEditorApplyVerb.cs
- HttpVersion.cs
- WindowShowOrOpenTracker.cs
- ToolStripSplitButton.cs
- DBCommandBuilder.cs
- COM2FontConverter.cs
- SingleConverter.cs
- SQLGuid.cs
- MappingModelBuildProvider.cs
- EpmSourcePathSegment.cs
- DataColumnChangeEvent.cs
- DelegateTypeInfo.cs
- PeerNode.cs
- TextBoxLine.cs
- DataGridViewHitTestInfo.cs
- UserInitiatedNavigationPermission.cs
- TextViewDesigner.cs
- FontWeight.cs
- ListControlBoundActionList.cs
- RTTypeWrapper.cs
- ContentPathSegment.cs
- ReadOnlyCollectionBase.cs
- TableParagraph.cs
- CompatibleIComparer.cs
- MouseEventArgs.cs
- DetailsViewPagerRow.cs
- Panel.cs
- FontWeightConverter.cs
- ParagraphResult.cs
- TextSimpleMarkerProperties.cs
- DataServiceConfiguration.cs
- Transform3D.cs
- MemberDomainMap.cs
- IsolatedStorageFileStream.cs
- RectangleF.cs
- AttributeQuery.cs
- ColorDialog.cs
- Border.cs
- FormattedText.cs
- DynamicQueryStringParameter.cs
- VirtualDirectoryMapping.cs
- XmlName.cs
- DBDataPermissionAttribute.cs
- XmlSchemaSet.cs
- SplitterDesigner.cs
- HttpRequest.cs
- ReadingWritingEntityEventArgs.cs
- ItemContainerGenerator.cs
- ToolStripRenderEventArgs.cs
- ConfigurationStrings.cs
- WizardForm.cs
- PerfCounterSection.cs
- _ServiceNameStore.cs
- ArraySortHelper.cs
- WebConvert.cs
- XmlWhitespace.cs
- AncestorChangedEventArgs.cs
- StringArrayConverter.cs
- SplitterCancelEvent.cs
- RuntimeCompatibilityAttribute.cs
- XmlSchemaCompilationSettings.cs
- LogicalCallContext.cs
- GrabHandleGlyph.cs
- WebPartCatalogAddVerb.cs
- Triplet.cs
- ItemAutomationPeer.cs
- SimpleFieldTemplateFactory.cs
- EntitySqlQueryCacheEntry.cs
- DatagridviewDisplayedBandsData.cs
- ZipIOCentralDirectoryBlock.cs
- RequestResponse.cs