Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //----------------------------------------------------------------------------- /* */ 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.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TimeManager.cs
- PositiveTimeSpanValidatorAttribute.cs
- HtmlTextArea.cs
- Int64Storage.cs
- ServiceModelEnumValidator.cs
- DateTimeParse.cs
- DataGridViewColumnDesigner.cs
- SelectQueryOperator.cs
- SqlNotificationRequest.cs
- TabControlEvent.cs
- ByteAnimationUsingKeyFrames.cs
- MatrixTransform.cs
- Nodes.cs
- VolatileResourceManager.cs
- BooleanAnimationUsingKeyFrames.cs
- HostedBindingBehavior.cs
- LayoutTable.cs
- DataGridLinkButton.cs
- PropertyDescriptorCollection.cs
- StoryFragments.cs
- TextTreePropertyUndoUnit.cs
- RotateTransform.cs
- CompositionTarget.cs
- ExecutionContext.cs
- AnnotationStore.cs
- Avt.cs
- cookie.cs
- BindingExpression.cs
- Line.cs
- SafeRightsManagementSessionHandle.cs
- RectangleConverter.cs
- InheritanceAttribute.cs
- Accessible.cs
- AffineTransform3D.cs
- RepeatButton.cs
- CharEntityEncoderFallback.cs
- WebPageTraceListener.cs
- WindowsAltTab.cs
- ManagementBaseObject.cs
- HandlerWithFactory.cs
- HttpSocketManager.cs
- DataKeyCollection.cs
- ResourceSet.cs
- DataGridTable.cs
- ColorConvertedBitmapExtension.cs
- TagPrefixInfo.cs
- Int32Collection.cs
- TemplateXamlTreeBuilder.cs
- Tool.cs
- Viewport3DAutomationPeer.cs
- KnownTypesHelper.cs
- Rect.cs
- X509SecurityTokenProvider.cs
- TemplatePropertyEntry.cs
- XmlSchema.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- CapacityStreamGeometryContext.cs
- Assembly.cs
- InputManager.cs
- ServiceOperationWrapper.cs
- EntityWrapperFactory.cs
- DataGridViewRowEventArgs.cs
- MemberBinding.cs
- LongTypeConverter.cs
- DeploymentExceptionMapper.cs
- CodeDirectionExpression.cs
- _SecureChannel.cs
- LicenseContext.cs
- IDispatchConstantAttribute.cs
- ISessionStateStore.cs
- RoutedCommand.cs
- TokenBasedSetEnumerator.cs
- BasePattern.cs
- Compiler.cs
- XmlSchemaSequence.cs
- CodeIdentifiers.cs
- Internal.cs
- TextServicesPropertyRanges.cs
- CodeObject.cs
- ClockController.cs
- CoTaskMemUnicodeSafeHandle.cs
- ProfilePropertySettings.cs
- _HeaderInfoTable.cs
- DataSysAttribute.cs
- AuthenticationService.cs
- DocumentsTrace.cs
- FixedSOMTableRow.cs
- ConnectionsZone.cs
- DataSourceView.cs
- EditBehavior.cs
- XamlPathDataSerializer.cs
- ControlParameter.cs
- PlatformCulture.cs
- SecureConversationVersion.cs
- PingOptions.cs
- MouseButtonEventArgs.cs
- AuthStoreRoleProvider.cs
- GeneralTransform.cs
- ClientScriptManager.cs
- ComboBox.cs