Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- MetabaseSettingsIis7.cs
- MultiViewDesigner.cs
- PseudoWebRequest.cs
- FormatterConverter.cs
- remotingproxy.cs
- Crc32Helper.cs
- RawTextInputReport.cs
- OdbcEnvironmentHandle.cs
- EmptyEnumerator.cs
- DragDeltaEventArgs.cs
- DeviceContext2.cs
- SoapHeaderAttribute.cs
- Win32KeyboardDevice.cs
- VarInfo.cs
- DoubleLinkList.cs
- LostFocusEventManager.cs
- NotifyCollectionChangedEventArgs.cs
- BitmapSourceSafeMILHandle.cs
- MonikerHelper.cs
- SoapReflector.cs
- CodeGroup.cs
- HttpModuleAction.cs
- SetterBaseCollection.cs
- MemberAccessException.cs
- XmlUtil.cs
- WriterOutput.cs
- MetadataArtifactLoaderComposite.cs
- DesignOnlyAttribute.cs
- IntegerFacetDescriptionElement.cs
- PreviewKeyDownEventArgs.cs
- IpcClientChannel.cs
- Funcletizer.cs
- DataGridBoolColumn.cs
- DataServiceResponse.cs
- ContentPlaceHolder.cs
- ThicknessConverter.cs
- DataList.cs
- XmlSignatureProperties.cs
- WorkflowTraceTransfer.cs
- StringPropertyBuilder.cs
- ParenExpr.cs
- RenderDataDrawingContext.cs
- ProcessStartInfo.cs
- AsymmetricAlgorithm.cs
- RelationshipFixer.cs
- CustomWebEventKey.cs
- ZoneLinkButton.cs
- TraceLog.cs
- ImmComposition.cs
- validationstate.cs
- MimePart.cs
- NamedElement.cs
- PassportAuthenticationEventArgs.cs
- EncodingDataItem.cs
- OdbcCommand.cs
- XamlUtilities.cs
- CompositeCollection.cs
- OleDbPermission.cs
- FileNotFoundException.cs
- UnmanagedMemoryStream.cs
- PerformanceCounterCategory.cs
- SynchronizingStream.cs
- MetadataUtilsSmi.cs
- ToolboxSnapDragDropEventArgs.cs
- DataGridViewCellStyle.cs
- CodeCatchClauseCollection.cs
- StandardOleMarshalObject.cs
- SqlMethodCallConverter.cs
- ClientScriptManagerWrapper.cs
- StylusCollection.cs
- WindowsListViewItemCheckBox.cs
- Point4DValueSerializer.cs
- DataGridViewComboBoxEditingControl.cs
- Thickness.cs
- WrappedKeySecurityTokenParameters.cs
- XmlQueryType.cs
- SQLDateTime.cs
- FillRuleValidation.cs
- AddInServer.cs
- HttpPostedFileWrapper.cs
- SQLChars.cs
- SecurityContext.cs
- ObjectStateManager.cs
- XPathNodeList.cs
- Page.cs
- AbstractDataSvcMapFileLoader.cs
- BufferModeSettings.cs
- TextDecorations.cs
- MasterPage.cs
- InputLanguageProfileNotifySink.cs
- MaxSessionCountExceededException.cs
- SubMenuStyle.cs
- SqlProvider.cs
- HttpException.cs
- Utility.cs
- AsyncOperation.cs
- UrlPath.cs
- ISAPIWorkerRequest.cs
- OutOfProcStateClientManager.cs
- DocumentOrderQuery.cs