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
- PersonalizationProviderHelper.cs
- GridItem.cs
- EmptyCollection.cs
- StrongNameKeyPair.cs
- PocoEntityKeyStrategy.cs
- ProgressBarAutomationPeer.cs
- InvokeSchedule.cs
- Screen.cs
- RadioButtonList.cs
- GridItemCollection.cs
- StylusEditingBehavior.cs
- EntityDesignPluralizationHandler.cs
- ToolStripPanelRow.cs
- CodeAttributeArgumentCollection.cs
- BitmapEffectDrawingContextWalker.cs
- StrongNameIdentityPermission.cs
- SessionStateSection.cs
- AttributeQuery.cs
- safemediahandle.cs
- SafeBitVector32.cs
- HttpServerProtocol.cs
- Metadata.cs
- DataGridTableCollection.cs
- MimeObjectFactory.cs
- TextModifierScope.cs
- NetNamedPipeBinding.cs
- SspiSafeHandles.cs
- HostingEnvironmentSection.cs
- XmlCharacterData.cs
- Regex.cs
- RowUpdatingEventArgs.cs
- DriveInfo.cs
- PropertySet.cs
- ToolStripComboBox.cs
- NotificationContext.cs
- SchemaNotation.cs
- BindToObject.cs
- XmlSerializerSection.cs
- XmlDocumentType.cs
- PropertyTab.cs
- EncryptedPackageFilter.cs
- MediaPlayerState.cs
- XmlSchemaComplexContentExtension.cs
- FloaterParaClient.cs
- AnimationClockResource.cs
- ActivitySurrogate.cs
- MaskedTextBoxTextEditor.cs
- EventWaitHandleSecurity.cs
- MobileFormsAuthentication.cs
- WindowsMenu.cs
- NamespaceImport.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- TypeGenericEnumerableViewSchema.cs
- activationcontext.cs
- HelpExampleGenerator.cs
- SafeSerializationManager.cs
- SystemIPInterfaceProperties.cs
- FormattedText.cs
- AssemblyBuilder.cs
- CodeTypeParameterCollection.cs
- ISAPIApplicationHost.cs
- CheckBoxAutomationPeer.cs
- TextBox.cs
- infer.cs
- Span.cs
- FormsAuthenticationUser.cs
- ComNativeDescriptor.cs
- HttpStreamXmlDictionaryReader.cs
- OperationAbortedException.cs
- wgx_commands.cs
- SharedPerformanceCounter.cs
- OleDbStruct.cs
- ToolBarButton.cs
- FormatterConverter.cs
- unitconverter.cs
- SHA512.cs
- MemberHolder.cs
- RequestQueryProcessor.cs
- BamlBinaryReader.cs
- SpecialFolderEnumConverter.cs
- XmlAnyElementAttribute.cs
- ColorTransformHelper.cs
- ArgumentNullException.cs
- DBNull.cs
- DbParameterCollectionHelper.cs
- FileEnumerator.cs
- SqlOuterApplyReducer.cs
- Msec.cs
- IntSecurity.cs
- SafeSecurityHelper.cs
- MSAAWinEventWrap.cs
- SqlDataSourceSelectingEventArgs.cs
- AggregatePushdown.cs
- BasicKeyConstraint.cs
- ScrollItemProviderWrapper.cs
- RowToParametersTransformer.cs
- Transform3D.cs
- SqlDesignerDataSourceView.cs
- HostProtectionPermission.cs
- CacheDependency.cs