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
- Command.cs
- IndicFontClient.cs
- Int32CollectionValueSerializer.cs
- XmlNavigatorFilter.cs
- PlatformNotSupportedException.cs
- NumberSubstitution.cs
- TextEffectResolver.cs
- OrderedDictionaryStateHelper.cs
- ConnectionsZoneDesigner.cs
- DoubleAnimation.cs
- FixedSOMTableRow.cs
- SettingsPropertyValueCollection.cs
- X509RawDataKeyIdentifierClause.cs
- ManagedIStream.cs
- Schema.cs
- SpeakInfo.cs
- SharedPersonalizationStateInfo.cs
- FatalException.cs
- ItemTypeToolStripMenuItem.cs
- Assert.cs
- CodeGroup.cs
- ApplicationSecurityInfo.cs
- EnumUnknown.cs
- InputScopeManager.cs
- UnmanagedHandle.cs
- PassportIdentity.cs
- Operator.cs
- CommonDialog.cs
- ZipIOCentralDirectoryBlock.cs
- XmlSchemaGroup.cs
- LicenseContext.cs
- VerifyHashRequest.cs
- Error.cs
- ExpressionPrefixAttribute.cs
- HyperLinkField.cs
- AsymmetricSignatureFormatter.cs
- TextureBrush.cs
- DataServiceProcessingPipeline.cs
- HttpNamespaceReservationInstallComponent.cs
- StorageEndPropertyMapping.cs
- DragDropHelper.cs
- AuthenticatedStream.cs
- OdbcFactory.cs
- SerializationStore.cs
- ColumnResult.cs
- CalendarDay.cs
- PathSegmentCollection.cs
- SafeUserTokenHandle.cs
- Matrix.cs
- RuleRefElement.cs
- SiteMapNodeCollection.cs
- BrowsableAttribute.cs
- NameValueSectionHandler.cs
- CopyOnWriteList.cs
- HtmlImage.cs
- ObjectDataSourceEventArgs.cs
- XomlDesignerLoader.cs
- ToolBarOverflowPanel.cs
- FacetChecker.cs
- followingsibling.cs
- Transform.cs
- DatePickerDateValidationErrorEventArgs.cs
- DataServiceHostWrapper.cs
- DynamicDocumentPaginator.cs
- ValidatorUtils.cs
- ContainerParagraph.cs
- HostingEnvironmentSection.cs
- CompilationUnit.cs
- WebResponse.cs
- CriticalFinalizerObject.cs
- WeakReferenceList.cs
- MemberAccessException.cs
- BooleanToVisibilityConverter.cs
- MasterPageCodeDomTreeGenerator.cs
- PreloadedPackages.cs
- EpmContentDeSerializerBase.cs
- BitmapSourceSafeMILHandle.cs
- CompiledQueryCacheEntry.cs
- InputLanguage.cs
- TextContainer.cs
- XmlMemberMapping.cs
- SqlUdtInfo.cs
- M3DUtil.cs
- ContentPlaceHolder.cs
- Range.cs
- ExtentCqlBlock.cs
- PeerApplicationLaunchInfo.cs
- TextServicesCompartment.cs
- FilteredReadOnlyMetadataCollection.cs
- ResourceContainerWrapper.cs
- ControlParameter.cs
- BitConverter.cs
- TextModifierScope.cs
- _FtpControlStream.cs
- ScrollViewerAutomationPeer.cs
- RuntimeResourceSet.cs
- EndpointInfoCollection.cs
- TransformPattern.cs
- ProfileParameter.cs
- WebPartConnectionsDisconnectVerb.cs