Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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 {
///
///
/// Gets a value indicating whether this converter can
/// convert an object to the given destination type using the context.
///
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
if (destinationType == typeof(InstanceDescriptor)) {
return true;
}
return base.CanConvertTo(context, destinationType);
}
///
///
/// 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Schema.cs
- ObjectRef.cs
- XmlDictionaryString.cs
- Inflater.cs
- ParseChildrenAsPropertiesAttribute.cs
- DataObjectMethodAttribute.cs
- ValidationRuleCollection.cs
- TagPrefixAttribute.cs
- RuntimeWrappedException.cs
- BasicKeyConstraint.cs
- InputMethodStateTypeInfo.cs
- XappLauncher.cs
- StateManager.cs
- VisualStateManager.cs
- HttpVersion.cs
- UriExt.cs
- Vector3dCollection.cs
- MetadataHelper.cs
- XmlCollation.cs
- NameNode.cs
- FrameworkObject.cs
- QueryReaderSettings.cs
- ExclusiveCanonicalizationTransform.cs
- Image.cs
- ReceiveMessageAndVerifySecurityAsyncResultBase.cs
- SecureEnvironment.cs
- WinFormsComponentEditor.cs
- IdentitySection.cs
- ElementHost.cs
- ReflectionUtil.cs
- Int32CollectionConverter.cs
- ValidationError.cs
- FillErrorEventArgs.cs
- OperationContext.cs
- IntSecurity.cs
- SafeTokenHandle.cs
- MemberAssignmentAnalysis.cs
- ExpressionPrefixAttribute.cs
- MD5CryptoServiceProvider.cs
- ExternalFile.cs
- AttachedAnnotationChangedEventArgs.cs
- XmlSchemaGroupRef.cs
- RuntimeConfigurationRecord.cs
- SkinBuilder.cs
- EventMetadata.cs
- ZoomPercentageConverter.cs
- ButtonChrome.cs
- XPathScanner.cs
- ListItemCollection.cs
- adornercollection.cs
- CookielessData.cs
- Int64Storage.cs
- NonDualMessageSecurityOverHttp.cs
- WebPartEditorOkVerb.cs
- RectConverter.cs
- SHA512Managed.cs
- DbCommandDefinition.cs
- PropertyInfo.cs
- CqlWriter.cs
- X509Extension.cs
- SchemaImporterExtension.cs
- DataGridColumnHeaderCollection.cs
- JulianCalendar.cs
- CollectionViewProxy.cs
- FileEnumerator.cs
- DbConnectionInternal.cs
- BoundsDrawingContextWalker.cs
- Point4D.cs
- SynchronizationContextHelper.cs
- InvokeHandlers.cs
- MsmqInputSessionChannelListener.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- TrustDriver.cs
- GlyphRunDrawing.cs
- EventRouteFactory.cs
- WsdlBuildProvider.cs
- ServiceCredentialsSecurityTokenManager.cs
- InboundActivityHelper.cs
- QilParameter.cs
- RequestQueryProcessor.cs
- PerformanceCounterLib.cs
- WebConfigurationFileMap.cs
- SizeAnimationBase.cs
- JsonDeserializer.cs
- ControlValuePropertyAttribute.cs
- TextStore.cs
- TextProviderWrapper.cs
- Hyperlink.cs
- StyleXamlParser.cs
- DynamicControl.cs
- CompositeTypefaceMetrics.cs
- XomlSerializationHelpers.cs
- FocusChangedEventArgs.cs
- ThreadInterruptedException.cs
- Socket.cs
- ClientRuntimeConfig.cs
- ConfigXmlElement.cs
- PlanCompilerUtil.cs
- ImageSourceConverter.cs
- SpellerInterop.cs