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
- NeutralResourcesLanguageAttribute.cs
- ProcessHost.cs
- SoapExtension.cs
- EdmSchemaError.cs
- TypeUsageBuilder.cs
- SocketException.cs
- DisableDpiAwarenessAttribute.cs
- ToolStripArrowRenderEventArgs.cs
- OleDbConnectionInternal.cs
- DocumentOrderQuery.cs
- DtrList.cs
- GridViewRowPresenterBase.cs
- SqlExpander.cs
- NamedElement.cs
- figurelength.cs
- FileUtil.cs
- DeflateInput.cs
- TypeSystem.cs
- XmlQualifiedNameTest.cs
- initElementDictionary.cs
- RelationshipDetailsCollection.cs
- PropertyKey.cs
- XPathNodeInfoAtom.cs
- ExtensionElementCollection.cs
- ReadWriteSpinLock.cs
- ProcessModelInfo.cs
- Int32Rect.cs
- CodeBlockBuilder.cs
- TextElementCollection.cs
- BamlRecordWriter.cs
- PageBuildProvider.cs
- TextSimpleMarkerProperties.cs
- TextTreeUndo.cs
- SByteConverter.cs
- SelectingProviderEventArgs.cs
- CaseInsensitiveComparer.cs
- Cursor.cs
- UnsafeNativeMethods.cs
- ParseChildrenAsPropertiesAttribute.cs
- MailWebEventProvider.cs
- FilterElement.cs
- ModelTreeEnumerator.cs
- ToolStripLocationCancelEventArgs.cs
- EventBuilder.cs
- Pointer.cs
- MenuItemBindingCollection.cs
- BaseComponentEditor.cs
- SessionParameter.cs
- DrawingContextDrawingContextWalker.cs
- FormatConvertedBitmap.cs
- NotCondition.cs
- ActiveXHost.cs
- HtmlUtf8RawTextWriter.cs
- ListViewSortEventArgs.cs
- AspNetSynchronizationContext.cs
- StrokeNodeEnumerator.cs
- SortKey.cs
- DataServiceStreamResponse.cs
- DefaultClaimSet.cs
- ServiceOperationParameter.cs
- DocumentEventArgs.cs
- CaseCqlBlock.cs
- ArrayList.cs
- ListenerSessionConnection.cs
- ConfigurationLocation.cs
- PerfService.cs
- ListControl.cs
- SuppressIldasmAttribute.cs
- PersonalizationProviderCollection.cs
- WebServiceErrorEvent.cs
- LinearGradientBrush.cs
- WebPartManager.cs
- FixedSOMTable.cs
- ValueExpressions.cs
- SerialPinChanges.cs
- DefaultTypeArgumentAttribute.cs
- UnsafeNativeMethods.cs
- TextDecorationCollectionConverter.cs
- NullableDoubleSumAggregationOperator.cs
- HtmlDocument.cs
- Event.cs
- CellIdBoolean.cs
- SoapHeaderAttribute.cs
- StreamSecurityUpgradeAcceptor.cs
- StatusBarItemAutomationPeer.cs
- Transform3DCollection.cs
- StyleTypedPropertyAttribute.cs
- PathFigureCollectionConverter.cs
- SchemaSetCompiler.cs
- ManipulationPivot.cs
- WorkflowInstanceTerminatedRecord.cs
- basecomparevalidator.cs
- PriorityBinding.cs
- RtfToken.cs
- HtmlInputHidden.cs
- ResourceProviderFactory.cs
- FileDialogCustomPlacesCollection.cs
- NodeInfo.cs
- ImageSourceConverter.cs
- UnsafeNativeMethodsCLR.cs