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
- StreamWithDictionary.cs
- FullTrustAssembliesSection.cs
- FormatControl.cs
- EncryptedPackage.cs
- hresults.cs
- InkCanvasAutomationPeer.cs
- TextAnchor.cs
- TranslateTransform.cs
- TypeExtensions.cs
- FileStream.cs
- Lease.cs
- WebRequest.cs
- TemplateControl.cs
- BatchParser.cs
- HandleCollector.cs
- SecureUICommand.cs
- GeneralTransform3DGroup.cs
- WebPartDisplayModeCollection.cs
- SqlFunctionAttribute.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- PartialCachingAttribute.cs
- OperandQuery.cs
- SqlDataSourceQueryConverter.cs
- CollectionBuilder.cs
- ObjectToModelValueConverter.cs
- MsmqHostedTransportManager.cs
- EntityContainerRelationshipSet.cs
- RightsManagementProvider.cs
- XmlValueConverter.cs
- UserValidatedEventArgs.cs
- Vector3DAnimation.cs
- BamlTreeUpdater.cs
- PropertyEntry.cs
- WebPartManagerInternals.cs
- Decorator.cs
- DragDropHelper.cs
- SchemaElementLookUpTable.cs
- ApplicationContext.cs
- SqlGenericUtil.cs
- InputProcessorProfiles.cs
- Location.cs
- SqlDataReaderSmi.cs
- KeyValueSerializer.cs
- ThreadStateException.cs
- OraclePermissionAttribute.cs
- StyleBamlRecordReader.cs
- OuterGlowBitmapEffect.cs
- DisplayClaim.cs
- RouteParameter.cs
- ImageClickEventArgs.cs
- MethodToken.cs
- XamlToRtfWriter.cs
- PrimitiveList.cs
- invalidudtexception.cs
- DynamicObject.cs
- Point3D.cs
- IFlowDocumentViewer.cs
- SqlDataAdapter.cs
- CompilationLock.cs
- CodeDomLocalizationProvider.cs
- ToolStripMenuItem.cs
- RegionIterator.cs
- EdmValidator.cs
- ContactManager.cs
- oledbconnectionstring.cs
- XsdBuildProvider.cs
- CodeSpit.cs
- DataGridCommandEventArgs.cs
- SetterBaseCollection.cs
- DataSysAttribute.cs
- WindowsFormsSectionHandler.cs
- Type.cs
- SynchronizedInputPattern.cs
- ActiveXContainer.cs
- dsa.cs
- BitmapSizeOptions.cs
- CacheHelper.cs
- ServicesSection.cs
- TextSearch.cs
- AsyncDataRequest.cs
- DataProtection.cs
- ValidatedControlConverter.cs
- IncrementalCompileAnalyzer.cs
- FileAuthorizationModule.cs
- BehaviorEditorPart.cs
- XmlCharType.cs
- CollectionEditVerbManager.cs
- NotFiniteNumberException.cs
- SHA384.cs
- MetadataArtifactLoaderCompositeFile.cs
- BamlCollectionHolder.cs
- TextBox.cs
- NullRuntimeConfig.cs
- ColorConvertedBitmapExtension.cs
- ClassData.cs
- ResXFileRef.cs
- HTTPNotFoundHandler.cs
- DesigntimeLicenseContext.cs
- Journaling.cs
- ReadOnlyMetadataCollection.cs