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
- InstanceCompleteException.cs
- HttpVersion.cs
- SafeSystemMetrics.cs
- DbDataRecord.cs
- AccessedThroughPropertyAttribute.cs
- InheritanceContextHelper.cs
- UnauthorizedWebPart.cs
- Scripts.cs
- ConsoleKeyInfo.cs
- ContentAlignmentEditor.cs
- CqlQuery.cs
- MenuItemCollection.cs
- _AuthenticationState.cs
- OleDbCommandBuilder.cs
- NetSectionGroup.cs
- EditorPartChrome.cs
- _ConnectionGroup.cs
- ContextToken.cs
- InputScopeConverter.cs
- MDIClient.cs
- SettingsPropertyCollection.cs
- ProfileGroupSettingsCollection.cs
- TemplateNameScope.cs
- NativeMethodsOther.cs
- Bits.cs
- OrderedDictionaryStateHelper.cs
- ParallelLoopState.cs
- LinqDataSourceContextEventArgs.cs
- XmlSchemaExporter.cs
- ImageAutomationPeer.cs
- Parser.cs
- MsmqTransportSecurity.cs
- OutputCacheProfile.cs
- EmptyCollection.cs
- entityreference_tresulttype.cs
- BaseUriWithWildcard.cs
- JoinCqlBlock.cs
- PartialArray.cs
- StoreItemCollection.cs
- Int16KeyFrameCollection.cs
- QilNode.cs
- XPathItem.cs
- XmlReader.cs
- StatusBarItem.cs
- TraceSection.cs
- ListBoxDesigner.cs
- FrameworkElement.cs
- TextTreeTextNode.cs
- CompiledQueryCacheKey.cs
- SqlDataSource.cs
- XmlSchemaValidationException.cs
- StyleHelper.cs
- BuildResultCache.cs
- BitmapEffectDrawingContextWalker.cs
- Stack.cs
- WebCodeGenerator.cs
- DataServiceSaveChangesEventArgs.cs
- BitFlagsGenerator.cs
- Int16Storage.cs
- DataControlButton.cs
- AssemblyCollection.cs
- InternalsVisibleToAttribute.cs
- SamlAction.cs
- ScriptingJsonSerializationSection.cs
- SqlSelectStatement.cs
- MLangCodePageEncoding.cs
- InputLanguageSource.cs
- DummyDataSource.cs
- XmlArrayItemAttribute.cs
- DesignerDataParameter.cs
- EnumerableRowCollection.cs
- UrlMappingCollection.cs
- UpdatePanelTriggerCollection.cs
- RowToParametersTransformer.cs
- ComplexPropertyEntry.cs
- EdmValidator.cs
- MimeTypeAttribute.cs
- FrameworkRichTextComposition.cs
- HashAlgorithm.cs
- Matrix.cs
- CodeArrayIndexerExpression.cs
- ScriptingWebServicesSectionGroup.cs
- DataGrid.cs
- SettingsAttributeDictionary.cs
- IpcClientManager.cs
- ListViewDeletedEventArgs.cs
- TypeGenericEnumerableViewSchema.cs
- ProfileSection.cs
- SessionStateModule.cs
- XsdDateTime.cs
- SchemaAttDef.cs
- CqlWriter.cs
- RemotingConfigParser.cs
- ComponentGuaranteesAttribute.cs
- DATA_BLOB.cs
- ProcessInputEventArgs.cs
- ValidationEventArgs.cs
- X509CertificateCollection.cs
- ReferentialConstraintRoleElement.cs
- HostedTcpTransportManager.cs