Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- listitem.cs
- CharacterHit.cs
- StateBag.cs
- SoapFault.cs
- HtmlInputRadioButton.cs
- PlainXmlDeserializer.cs
- HttpInputStream.cs
- XmlQueryCardinality.cs
- OverflowException.cs
- HostingEnvironment.cs
- WebPartUserCapability.cs
- UnmanagedMemoryStreamWrapper.cs
- TextElementCollectionHelper.cs
- AutoCompleteStringCollection.cs
- SweepDirectionValidation.cs
- DescriptionAttribute.cs
- CharacterBufferReference.cs
- XomlCompilerError.cs
- SettingsPropertyCollection.cs
- SmtpReplyReaderFactory.cs
- AppDomainProtocolHandler.cs
- TimeStampChecker.cs
- DataQuery.cs
- CompilerTypeWithParams.cs
- InProcStateClientManager.cs
- DataFormats.cs
- FixedFlowMap.cs
- WindowsFormsHostPropertyMap.cs
- CollectionBase.cs
- XmlDigitalSignatureProcessor.cs
- BitmapEffectGeneralTransform.cs
- ImpersonateTokenRef.cs
- WebZoneDesigner.cs
- StreamWriter.cs
- ExpressionPrefixAttribute.cs
- StreamGeometry.cs
- AbsoluteQuery.cs
- HtmlForm.cs
- AliasExpr.cs
- StyleSelector.cs
- UnregisterInfo.cs
- MembershipAdapter.cs
- Color.cs
- CharacterShapingProperties.cs
- ByteStorage.cs
- SafeEventLogWriteHandle.cs
- EventManager.cs
- PropertyGridEditorPart.cs
- ButtonFieldBase.cs
- Int32AnimationBase.cs
- WizardStepBase.cs
- Msec.cs
- Command.cs
- DeploymentExceptionMapper.cs
- ResourceDescriptionAttribute.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- SHA384Managed.cs
- FlowPosition.cs
- ReaderContextStackData.cs
- GlyphsSerializer.cs
- XmlIterators.cs
- Renderer.cs
- ProxyHelper.cs
- CheckBoxDesigner.cs
- NetworkAddressChange.cs
- AsyncResult.cs
- MonitoringDescriptionAttribute.cs
- ToolBarButtonClickEvent.cs
- ConvertersCollection.cs
- TiffBitmapEncoder.cs
- DataGridTable.cs
- GradientStopCollection.cs
- BooleanToVisibilityConverter.cs
- ObjectNavigationPropertyMapping.cs
- OleDbCommand.cs
- SqlGenericUtil.cs
- Run.cs
- HttpServerVarsCollection.cs
- XamlTypeWithExplicitNamespace.cs
- EntityClassGenerator.cs
- ExpressionBinding.cs
- Padding.cs
- StreamHelper.cs
- ValueConversionAttribute.cs
- Size.cs
- BulletedList.cs
- EnumValAlphaComparer.cs
- EnumBuilder.cs
- ConnectionString.cs
- FlowLayout.cs
- DbConnectionPoolOptions.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- ReadOnlyHierarchicalDataSourceView.cs
- BaseCAMarshaler.cs
- AnnotationResource.cs
- ObjectHandle.cs
- ValueUnavailableException.cs
- StylusSystemGestureEventArgs.cs
- OpenTypeMethods.cs
- latinshape.cs