Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / TreeViewImageKeyConverter.cs / 1 / TreeViewImageKeyConverter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.Windows.Forms {
using Microsoft.Win32;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Collections.Specialized;
///
///
/// ImageIndexConverter is a class that can be used to convert
/// image index values one data type to another.
///
public class TreeViewImageKeyConverter : ImageKeyConverter {
///
///
/// 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(string) && (value == null)) {
return SR.GetString(SR.toStringDefault);
}
else {
string strValue = value as string;
if (strValue != null && (strValue.Length == 0)) {
return SR.GetString(SR.toStringDefault);
}
}
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
- Vector3DAnimationBase.cs
- XPathEmptyIterator.cs
- CacheMemory.cs
- BindingUtils.cs
- XmlSchemaChoice.cs
- WebPartMenu.cs
- SetIterators.cs
- SQLMoney.cs
- ShaderRenderModeValidation.cs
- ParsedRoute.cs
- ToolStripLocationCancelEventArgs.cs
- BaseEntityWrapper.cs
- BoundsDrawingContextWalker.cs
- StorageEntityTypeMapping.cs
- TextEditorParagraphs.cs
- mediaeventargs.cs
- MeshGeometry3D.cs
- InputMethodStateChangeEventArgs.cs
- CustomValidator.cs
- ApplicationHost.cs
- SmiTypedGetterSetter.cs
- TextShapeableCharacters.cs
- EncryptedPackageFilter.cs
- FixedHyperLink.cs
- ScrollEventArgs.cs
- SafeNativeMethods.cs
- TableSectionStyle.cs
- EntityUtil.cs
- assertwrapper.cs
- ProtocolState.cs
- HMAC.cs
- SqlRowUpdatedEvent.cs
- StylusLogic.cs
- MessageAction.cs
- TypeSystem.cs
- RoleGroupCollectionEditor.cs
- XmlSchemaAnnotation.cs
- InfoCardSymmetricAlgorithm.cs
- Config.cs
- RoleGroupCollection.cs
- WindowsSolidBrush.cs
- SizeAnimationUsingKeyFrames.cs
- Trace.cs
- SerializeAbsoluteContext.cs
- AccessedThroughPropertyAttribute.cs
- TextRangeProviderWrapper.cs
- SslStream.cs
- QueuePropertyVariants.cs
- ReadOnlyNameValueCollection.cs
- ObjectDataSourceMethodEventArgs.cs
- BuildResultCache.cs
- Camera.cs
- GlobalizationAssembly.cs
- DataViewSetting.cs
- BitmapEffectGroup.cs
- ClientUIRequest.cs
- HtmlForm.cs
- XmlSchemaSimpleContentRestriction.cs
- Transform3DGroup.cs
- RelationshipFixer.cs
- RecognizedWordUnit.cs
- MethodCallConverter.cs
- ClickablePoint.cs
- InteropAutomationProvider.cs
- ExtensionMethods.cs
- KeyboardEventArgs.cs
- DesignerForm.cs
- _NTAuthentication.cs
- DbConnectionPoolGroupProviderInfo.cs
- UInt16.cs
- ComNativeDescriptor.cs
- PersonalizablePropertyEntry.cs
- SendKeys.cs
- KeyInstance.cs
- HttpValueCollection.cs
- DesignerWidgets.cs
- DataListGeneralPage.cs
- XPathMultyIterator.cs
- ConfigXmlReader.cs
- UserPreferenceChangingEventArgs.cs
- TableItemPattern.cs
- StructuralObject.cs
- EmbeddedMailObjectCollectionEditor.cs
- NameNode.cs
- Attachment.cs
- InternalConfigEventArgs.cs
- Empty.cs
- OracleString.cs
- InvalidPropValue.cs
- TreePrinter.cs
- Deflater.cs
- Viewport3DVisual.cs
- OutputCacheProfileCollection.cs
- InvalidOperationException.cs
- AsymmetricSignatureFormatter.cs
- AvtEvent.cs
- EdmMember.cs
- EntityDataSourceUtil.cs
- ThreadInterruptedException.cs
- AbstractSvcMapFileLoader.cs