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
- BaseContextMenu.cs
- DataGridViewColumnStateChangedEventArgs.cs
- WorkflowServiceNamespace.cs
- WindowsAuthenticationEventArgs.cs
- XamlTreeBuilder.cs
- WSTrust.cs
- SourceInterpreter.cs
- LayoutDump.cs
- XPathPatternParser.cs
- ConvertEvent.cs
- SingleKeyFrameCollection.cs
- CqlParserHelpers.cs
- CaseInsensitiveOrdinalStringComparer.cs
- AutomationElement.cs
- TimeSpanStorage.cs
- TypeHelper.cs
- FileDetails.cs
- TypeConverterValueSerializer.cs
- XsdValidatingReader.cs
- GlobalizationAssembly.cs
- XmlSchemaAppInfo.cs
- ProfileEventArgs.cs
- PolicyStatement.cs
- sqlstateclientmanager.cs
- WeakEventTable.cs
- BreadCrumbTextConverter.cs
- SystemSounds.cs
- CapabilitiesPattern.cs
- FileLogRecordEnumerator.cs
- SourceSwitch.cs
- IntranetCredentialPolicy.cs
- NullRuntimeConfig.cs
- Calendar.cs
- RemoteEndpointMessageProperty.cs
- ToolStripContainer.cs
- ClientBuildManagerCallback.cs
- NameService.cs
- CngUIPolicy.cs
- ShapingWorkspace.cs
- ApplicationSecurityManager.cs
- GacUtil.cs
- ClientProxyGenerator.cs
- EmptyStringExpandableObjectConverter.cs
- HotSpot.cs
- WindowsListBox.cs
- HWStack.cs
- CqlParserHelpers.cs
- SQLConvert.cs
- Fonts.cs
- XmlObjectSerializerReadContextComplexJson.cs
- Underline.cs
- ListenDesigner.cs
- SupportingTokenAuthenticatorSpecification.cs
- DispatchChannelSink.cs
- DeleteIndexBinder.cs
- WinFormsComponentEditor.cs
- securitymgrsite.cs
- ExceptionHandlersDesigner.cs
- TableDetailsCollection.cs
- Crc32.cs
- XamlInterfaces.cs
- GroupItemAutomationPeer.cs
- GeometryHitTestResult.cs
- WebHostUnsafeNativeMethods.cs
- WebPartUserCapability.cs
- AlternationConverter.cs
- SafeProcessHandle.cs
- HandlerWithFactory.cs
- InstanceBehavior.cs
- _OverlappedAsyncResult.cs
- SettingsPropertyNotFoundException.cs
- DataGridViewControlCollection.cs
- Lease.cs
- EncryptedKeyIdentifierClause.cs
- TypeSystemHelpers.cs
- MobileTemplatedControlDesigner.cs
- EventLogPermission.cs
- SqlIdentifier.cs
- XmlIlVisitor.cs
- BaseTemplateCodeDomTreeGenerator.cs
- FtpWebResponse.cs
- PointAnimationBase.cs
- LabelAutomationPeer.cs
- UIAgentAsyncParams.cs
- CodeDomSerializationProvider.cs
- Vector3D.cs
- WrappedIUnknown.cs
- EnumerableCollectionView.cs
- ConsoleKeyInfo.cs
- MergeLocalizationDirectives.cs
- CoTaskMemSafeHandle.cs
- TextTreeObjectNode.cs
- CopyCodeAction.cs
- ToolBar.cs
- ParseChildrenAsPropertiesAttribute.cs
- Certificate.cs
- XPathScanner.cs
- AVElementHelper.cs
- RepeaterItemCollection.cs
- MatrixConverter.cs