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
- AccessDataSourceView.cs
- OperationInfo.cs
- DbConnectionStringCommon.cs
- OletxTransactionHeader.cs
- TriggerAction.cs
- TransactionManager.cs
- PeerInvitationResponse.cs
- PropertyTabChangedEvent.cs
- ScriptResourceAttribute.cs
- DynamicQueryableWrapper.cs
- XmlSerializationGeneratedCode.cs
- SqlCacheDependency.cs
- RouteValueExpressionBuilder.cs
- DrawListViewColumnHeaderEventArgs.cs
- DataGridColumnsPage.cs
- BamlLocalizationDictionary.cs
- XmlSigningNodeWriter.cs
- DecimalKeyFrameCollection.cs
- SpecularMaterial.cs
- Panel.cs
- FilterableData.cs
- ExpressionBindingCollection.cs
- COM2ColorConverter.cs
- CacheDependency.cs
- FtpRequestCacheValidator.cs
- RelationshipDetailsRow.cs
- TextDocumentView.cs
- AuthenticationService.cs
- ItemList.cs
- SafeCryptContextHandle.cs
- XmlNamespaceMapping.cs
- DatePicker.cs
- UICuesEvent.cs
- ToolstripProfessionalRenderer.cs
- InputReferenceExpression.cs
- StrokeCollectionConverter.cs
- ExclusiveCanonicalizationTransform.cs
- ComplexBindingPropertiesAttribute.cs
- SoapIncludeAttribute.cs
- ProcessHostServerConfig.cs
- IQueryable.cs
- MethodBuilder.cs
- ValidatorCollection.cs
- ToolBarButton.cs
- ConfigsHelper.cs
- Collection.cs
- FieldAccessException.cs
- SafeBitVector32.cs
- WCFModelStrings.Designer.cs
- TaskFileService.cs
- FreeFormDragDropManager.cs
- KeyboardEventArgs.cs
- SecurityException.cs
- TextWriterTraceListener.cs
- EnumType.cs
- DragAssistanceManager.cs
- DuplicateWaitObjectException.cs
- InputScopeNameConverter.cs
- HttpHandlersSection.cs
- ToggleButtonAutomationPeer.cs
- ButtonStandardAdapter.cs
- CFGGrammar.cs
- ArglessEventHandlerProxy.cs
- ProgressBar.cs
- BinaryWriter.cs
- GridEntryCollection.cs
- ReliableInputConnection.cs
- NodeLabelEditEvent.cs
- DataPagerFieldCollection.cs
- Evaluator.cs
- Repeater.cs
- FontWeights.cs
- ColorKeyFrameCollection.cs
- TwoPhaseCommit.cs
- EmptyImpersonationContext.cs
- SerializationSectionGroup.cs
- ISAPIApplicationHost.cs
- WebPartCatalogAddVerb.cs
- LineUtil.cs
- Point3DAnimationUsingKeyFrames.cs
- HttpResponseInternalWrapper.cs
- BuildProvider.cs
- ToolBarOverflowPanel.cs
- ExpressionNode.cs
- DefaultParameterValueAttribute.cs
- ReceiveActivityDesigner.cs
- FeatureSupport.cs
- AmbientLight.cs
- Tile.cs
- AppDomainFactory.cs
- Geometry3D.cs
- RoleService.cs
- GridViewRowEventArgs.cs
- Message.cs
- TextRunCacheImp.cs
- CustomErrorsSection.cs
- initElementDictionary.cs
- PtsCache.cs
- ResourceContainer.cs
- XPathParser.cs