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
- CharacterMetricsDictionary.cs
- Expr.cs
- DataGridViewTopRowAccessibleObject.cs
- Bold.cs
- BitSet.cs
- HostingEnvironmentWrapper.cs
- ResXResourceReader.cs
- ComplusEndpointConfigContainer.cs
- HeaderedItemsControl.cs
- SoapObjectWriter.cs
- FrameworkElement.cs
- IdentityReference.cs
- HttpWebResponse.cs
- DataContext.cs
- DataListItemEventArgs.cs
- VideoDrawing.cs
- RealProxy.cs
- MatrixCamera.cs
- DeclaredTypeElementCollection.cs
- Helper.cs
- AsymmetricAlgorithm.cs
- DefaultValidator.cs
- CommonObjectSecurity.cs
- MethodBody.cs
- MimeMultiPart.cs
- LogWriteRestartAreaAsyncResult.cs
- XmlSchemaSubstitutionGroup.cs
- SelectedDatesCollection.cs
- Vector.cs
- XmlArrayAttribute.cs
- FacetChecker.cs
- Timer.cs
- CfgParser.cs
- ConnectionManagementElementCollection.cs
- FlowDocumentReaderAutomationPeer.cs
- ReferenceEqualityComparer.cs
- FunctionParameter.cs
- StringPropertyBuilder.cs
- PanelDesigner.cs
- TableColumnCollectionInternal.cs
- MissingManifestResourceException.cs
- SettingsSection.cs
- SizeAnimationClockResource.cs
- CustomErrorsSectionWrapper.cs
- LeftCellWrapper.cs
- WinFormsSpinner.cs
- GAC.cs
- TimeSpanSecondsConverter.cs
- DocumentViewerConstants.cs
- CompressEmulationStream.cs
- CommandDesigner.cs
- WmlPageAdapter.cs
- RelationshipEndCollection.cs
- ListView.cs
- ProfileSettingsCollection.cs
- GetWinFXPath.cs
- MimeMapping.cs
- OrthographicCamera.cs
- CanExecuteRoutedEventArgs.cs
- PngBitmapEncoder.cs
- PathSegment.cs
- WindowClosedEventArgs.cs
- AppSettingsReader.cs
- TreeViewBindingsEditor.cs
- HuffmanTree.cs
- TableItemProviderWrapper.cs
- AbandonedMutexException.cs
- WebMessageEncodingElement.cs
- Executor.cs
- odbcmetadatafactory.cs
- TextViewBase.cs
- SkipStoryboardToFill.cs
- Rijndael.cs
- ClientBuildManagerCallback.cs
- BreakRecordTable.cs
- TimeEnumHelper.cs
- StylusPointProperty.cs
- KnownTypesHelper.cs
- _TLSstream.cs
- ThreadWorkerController.cs
- ImportContext.cs
- HwndMouseInputProvider.cs
- Int32Rect.cs
- WindowsClaimSet.cs
- __ConsoleStream.cs
- MemberInfoSerializationHolder.cs
- LoadWorkflowByInstanceKeyCommand.cs
- WebPartEditorApplyVerb.cs
- FixUp.cs
- EditCommandColumn.cs
- PerformanceCounterPermissionEntry.cs
- Cursor.cs
- Stackframe.cs
- PropertyEmitterBase.cs
- WebPartChrome.cs
- QueryAccessibilityHelpEvent.cs
- EntityDescriptor.cs
- StrongNamePublicKeyBlob.cs
- EndPoint.cs
- XslAst.cs