Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewCellStyleConverter.cs / 1305376 / 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
- RepeatBehavior.cs
- AffineTransform3D.cs
- SchemaCollectionCompiler.cs
- WindowsButton.cs
- CompilationUtil.cs
- VectorCollection.cs
- TypeUtil.cs
- ISFClipboardData.cs
- DataGridViewDesigner.cs
- MultiBindingExpression.cs
- XsltConvert.cs
- PagerSettings.cs
- SafeProcessHandle.cs
- XmlElementAttribute.cs
- LocalIdKeyIdentifierClause.cs
- LookupBindingPropertiesAttribute.cs
- ButtonRenderer.cs
- IndicFontClient.cs
- ActivitiesCollection.cs
- CompoundFileReference.cs
- SearchForVirtualItemEventArgs.cs
- SafeEventLogWriteHandle.cs
- SchemaNamespaceManager.cs
- CodeSnippetTypeMember.cs
- ZipIOLocalFileHeader.cs
- ActivationArguments.cs
- ChannelSinkStacks.cs
- filewebresponse.cs
- MsmqAppDomainProtocolHandler.cs
- PersonalizationAdministration.cs
- FillBehavior.cs
- PeerApplicationLaunchInfo.cs
- ListItemCollection.cs
- GifBitmapEncoder.cs
- ExtensionsSection.cs
- LogWriteRestartAreaState.cs
- FileDialogCustomPlaces.cs
- LicFileLicenseProvider.cs
- UITypeEditor.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- HtmlFormParameterReader.cs
- DataPagerFieldCommandEventArgs.cs
- VectorAnimationBase.cs
- WebPartAddingEventArgs.cs
- CustomTypeDescriptor.cs
- SelectionList.cs
- DbConnectionStringCommon.cs
- PersonalizationProvider.cs
- WebConfigurationHostFileChange.cs
- WindowsListViewGroupSubsetLink.cs
- AmbientValueAttribute.cs
- QueryOperationResponseOfT.cs
- DriveInfo.cs
- XmlAttributeOverrides.cs
- ColumnHeaderConverter.cs
- EntityProviderServices.cs
- WebConfigurationHostFileChange.cs
- WsatProxy.cs
- ResourcePool.cs
- TreeWalker.cs
- FixedPageProcessor.cs
- UpdateRecord.cs
- DirectoryNotFoundException.cs
- coordinatorscratchpad.cs
- TdsParserSessionPool.cs
- RoutedPropertyChangedEventArgs.cs
- WebPartAddingEventArgs.cs
- FixedSOMTable.cs
- CounterSampleCalculator.cs
- GridViewDeleteEventArgs.cs
- CodeSnippetCompileUnit.cs
- QilExpression.cs
- PageThemeBuildProvider.cs
- PageParserFilter.cs
- RegexWorker.cs
- ECDiffieHellmanCngPublicKey.cs
- MembershipPasswordException.cs
- XmlMemberMapping.cs
- WebPartHelpVerb.cs
- MD5HashHelper.cs
- SqlFactory.cs
- Stack.cs
- StatusStrip.cs
- PersianCalendar.cs
- SymLanguageType.cs
- FreezableDefaultValueFactory.cs
- SmiContext.cs
- ServiceModelSecurityTokenTypes.cs
- HttpApplicationFactory.cs
- LazyTextWriterCreator.cs
- RecordsAffectedEventArgs.cs
- ControlValuePropertyAttribute.cs
- SHA1Managed.cs
- _NativeSSPI.cs
- Localizer.cs
- shaper.cs
- XmlFormatMapping.cs
- SspiNegotiationTokenAuthenticatorState.cs
- X509CertificateClaimSet.cs
- PasswordRecovery.cs