Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewCellStyleConverter.cs / 1 / DataGridViewCellStyleConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Diagnostics; using System.Globalization; using System.Reflection; ////// /// public class DataGridViewCellStyleConverter : TypeConverter { ////// /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ///Gets a value indicating whether this converter can /// convert an object to the given destination type using the context. ////// /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination /// type is string. If this cannot convert to the desitnation type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(InstanceDescriptor) && value is DataGridViewCellStyle) { ConstructorInfo ctor = value.GetType().GetConstructor(new Type[0]); 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. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Diagnostics; using System.Globalization; using System.Reflection; ////// /// public class DataGridViewCellStyleConverter : TypeConverter { ////// /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ///Gets a value indicating whether this converter can /// convert an object to the given destination type using the context. ////// /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination /// type is string. If this cannot convert to the desitnation type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(InstanceDescriptor) && value is DataGridViewCellStyle) { ConstructorInfo ctor = value.GetType().GetConstructor(new Type[0]); 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpResponseHeader.cs
- VSDExceptions.cs
- SimpleLine.cs
- XpsColorContext.cs
- FormattedTextSymbols.cs
- AutomationElement.cs
- PointCollection.cs
- XmlBaseWriter.cs
- DataShape.cs
- CallSiteHelpers.cs
- ApplicationInfo.cs
- LinkedResourceCollection.cs
- Pool.cs
- ReflectPropertyDescriptor.cs
- _AutoWebProxyScriptEngine.cs
- JsonGlobals.cs
- XslCompiledTransform.cs
- HttpModuleActionCollection.cs
- FixedPageStructure.cs
- ParseNumbers.cs
- HashCodeCombiner.cs
- DeferredElementTreeState.cs
- InternalRelationshipCollection.cs
- Size.cs
- GridEntryCollection.cs
- ObjectViewFactory.cs
- FormClosingEvent.cs
- VirtualizingStackPanel.cs
- WebPartZoneCollection.cs
- ClientBuildManager.cs
- Message.cs
- DbConnectionPoolGroupProviderInfo.cs
- LinkedList.cs
- Brush.cs
- PathStreamGeometryContext.cs
- BrowserCapabilitiesFactoryBase.cs
- SatelliteContractVersionAttribute.cs
- SiteMapNodeCollection.cs
- PermissionSetTriple.cs
- Transform.cs
- DataGridCell.cs
- EntityDataSourceDesignerHelper.cs
- FrameworkElementFactoryMarkupObject.cs
- SqlUnionizer.cs
- PreloadedPackages.cs
- SchemaImporterExtensionElementCollection.cs
- RowUpdatingEventArgs.cs
- DeclaredTypeValidatorAttribute.cs
- FlowLayoutPanel.cs
- ValidatorCompatibilityHelper.cs
- TrustSection.cs
- CompensationHandlingFilter.cs
- XmlCDATASection.cs
- SqlDataSource.cs
- LocalizableAttribute.cs
- FileDialog_Vista_Interop.cs
- CodePrimitiveExpression.cs
- AspNetCacheProfileAttribute.cs
- DataGridClipboardCellContent.cs
- PkcsUtils.cs
- ConfigurationPropertyAttribute.cs
- ToolboxItemAttribute.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- WebConfigurationFileMap.cs
- XmlDataDocument.cs
- SemaphoreSecurity.cs
- ModelProperty.cs
- StretchValidation.cs
- TraceUtils.cs
- CounterSample.cs
- HandleRef.cs
- ReferenceConverter.cs
- OptimizerPatterns.cs
- ExpressionVisitorHelpers.cs
- GZipDecoder.cs
- ExpressionBuilder.cs
- DockAndAnchorLayout.cs
- DriveInfo.cs
- BlobPersonalizationState.cs
- ApplicationHost.cs
- UnitySerializationHolder.cs
- EventLogTraceListener.cs
- NameValueSectionHandler.cs
- WaitForChangedResult.cs
- XslCompiledTransform.cs
- ComboBoxRenderer.cs
- ProcessHostFactoryHelper.cs
- OleTxTransaction.cs
- CorrelationManager.cs
- WebColorConverter.cs
- DebugView.cs
- WinInet.cs
- path.cs
- XmlWrappingReader.cs
- RegexMatchCollection.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- FieldNameLookup.cs
- DataObject.cs
- AllMembershipCondition.cs
- EtwTrace.cs