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
- DirectionalLight.cs
- DecoderExceptionFallback.cs
- AttachedPropertyBrowsableAttribute.cs
- XmlAttributeOverrides.cs
- CommonXSendMessage.cs
- XamlDesignerSerializationManager.cs
- ProfileSection.cs
- XmlSchemaValidator.cs
- BitmapData.cs
- UpdateCommandGenerator.cs
- Wildcard.cs
- LightweightCodeGenerator.cs
- OperatingSystemVersionCheck.cs
- ListViewItemMouseHoverEvent.cs
- Control.cs
- DataRowChangeEvent.cs
- PenContext.cs
- FlowPosition.cs
- UxThemeWrapper.cs
- CorrelationManager.cs
- ButtonPopupAdapter.cs
- DesignerMetadata.cs
- ArrayTypeMismatchException.cs
- PhoneCall.cs
- TempFiles.cs
- PropertyGeneratedEventArgs.cs
- ErrorWebPart.cs
- TextContainerChangeEventArgs.cs
- PoisonMessageException.cs
- StickyNoteContentControl.cs
- Intellisense.cs
- XPathNavigatorKeyComparer.cs
- UIElementHelper.cs
- UrlRoutingHandler.cs
- WebDisplayNameAttribute.cs
- DataGridViewTextBoxCell.cs
- Grid.cs
- AsyncStreamReader.cs
- Bitmap.cs
- DefaultValidator.cs
- ConfigurationStrings.cs
- XmlCharCheckingWriter.cs
- ProtocolsConfiguration.cs
- TaskScheduler.cs
- BasicHttpMessageSecurity.cs
- XmlSchemaAll.cs
- QuaternionAnimation.cs
- ResumeStoryboard.cs
- ChameleonKey.cs
- SessionState.cs
- XmlDocument.cs
- XmlWellformedWriter.cs
- FileDialog_Vista_Interop.cs
- XmlDocumentType.cs
- ObjectStateEntry.cs
- ControlBuilder.cs
- XmlSerializableWriter.cs
- Byte.cs
- AnnotationHelper.cs
- ETagAttribute.cs
- PersonalizationDictionary.cs
- DesignerVerbToolStripMenuItem.cs
- ConfigurationValues.cs
- CellParaClient.cs
- QilInvokeEarlyBound.cs
- SystemFonts.cs
- BamlRecordHelper.cs
- FaultDescription.cs
- FrameworkObject.cs
- ProcessThreadCollection.cs
- TypePropertyEditor.cs
- TextEditorCopyPaste.cs
- TemplateModeChangedEventArgs.cs
- URIFormatException.cs
- PeekCompletedEventArgs.cs
- FormViewCommandEventArgs.cs
- QuaternionKeyFrameCollection.cs
- EdmError.cs
- VarRefManager.cs
- DesignerView.Commands.cs
- TextBoxDesigner.cs
- hresults.cs
- ArithmeticException.cs
- coordinatorscratchpad.cs
- KeyboardDevice.cs
- InvokeGenerator.cs
- FileSystemEventArgs.cs
- RawStylusInputCustomData.cs
- WorkflowEventArgs.cs
- XamlToRtfParser.cs
- NativeMethods.cs
- NamespaceQuery.cs
- SettingsPropertyNotFoundException.cs
- Quaternion.cs
- HiddenFieldPageStatePersister.cs
- KeyGesture.cs
- coordinator.cs
- ImageConverter.cs
- ClientConvert.cs
- ClientRuntimeConfig.cs