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
- GridErrorDlg.cs
- Formatter.cs
- InfoCardKeyedHashAlgorithm.cs
- SizeLimitedCache.cs
- TypeConstant.cs
- WebConfigurationManager.cs
- ListViewItem.cs
- GiveFeedbackEvent.cs
- DataGridViewSelectedCellCollection.cs
- GuidelineCollection.cs
- DecoderExceptionFallback.cs
- DataTableClearEvent.cs
- DeploymentExceptionMapper.cs
- WebPartTracker.cs
- DateRangeEvent.cs
- List.cs
- MessageDesigner.cs
- EditingCommands.cs
- ComponentDispatcher.cs
- TextTrailingWordEllipsis.cs
- EnumBuilder.cs
- SqlFormatter.cs
- XsdBuildProvider.cs
- FlowDocumentScrollViewer.cs
- FixedPosition.cs
- ForwardPositionQuery.cs
- TypeViewSchema.cs
- SqlDataSourceQuery.cs
- DatatypeImplementation.cs
- VersionUtil.cs
- ListParagraph.cs
- GroupBoxAutomationPeer.cs
- ACE.cs
- XmlSchemaElement.cs
- PermissionSetEnumerator.cs
- UIHelper.cs
- SecurityTokenValidationException.cs
- SchemaImporterExtensionElement.cs
- mediaclock.cs
- SqlCacheDependencySection.cs
- AudioLevelUpdatedEventArgs.cs
- RemotingAttributes.cs
- SchemaDeclBase.cs
- CurrencyManager.cs
- NavigationCommands.cs
- HebrewNumber.cs
- ImmutableClientRuntime.cs
- SqlReorderer.cs
- FastPropertyAccessor.cs
- DataChangedEventManager.cs
- TraceFilter.cs
- FilterElement.cs
- InternalRelationshipCollection.cs
- ArgumentNullException.cs
- XPathAxisIterator.cs
- dtdvalidator.cs
- CompiledQueryCacheEntry.cs
- SkipStoryboardToFill.cs
- BaseComponentEditor.cs
- BorderGapMaskConverter.cs
- StreamAsIStream.cs
- AuthenticationServiceManager.cs
- PaintValueEventArgs.cs
- Literal.cs
- XPathArrayIterator.cs
- OutOfProcStateClientManager.cs
- HighlightOverlayGlyph.cs
- FileStream.cs
- MinMaxParagraphWidth.cs
- CheckBoxField.cs
- SessionState.cs
- CodeGen.cs
- LinqDataSourceEditData.cs
- SoapIgnoreAttribute.cs
- WebExceptionStatus.cs
- MenuBase.cs
- ArrayElementGridEntry.cs
- Panel.cs
- bidPrivateBase.cs
- _HeaderInfo.cs
- OdbcError.cs
- OdbcTransaction.cs
- SpotLight.cs
- GroupBoxRenderer.cs
- PickBranch.cs
- HttpCachePolicyElement.cs
- DBProviderConfigurationHandler.cs
- ClassGenerator.cs
- SerialErrors.cs
- Shared.cs
- ScrollableControl.cs
- ClipboardProcessor.cs
- EntitySetBase.cs
- WorkflowValidationFailedException.cs
- StringValidatorAttribute.cs
- HttpRawResponse.cs
- EmbeddedMailObject.cs
- SmiMetaDataProperty.cs
- DataBoundControlHelper.cs
- PropertyGridEditorPart.cs