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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RuntimeCompatibilityAttribute.cs
- SettingsBase.cs
- RewritingProcessor.cs
- SimpleType.cs
- Margins.cs
- TableParaClient.cs
- UpdateExpressionVisitor.cs
- HierarchicalDataSourceControl.cs
- AlignmentYValidation.cs
- XPathAxisIterator.cs
- Panel.cs
- SystemWebSectionGroup.cs
- TreeViewEvent.cs
- SQLSingle.cs
- DefaultPrintController.cs
- XmlText.cs
- GiveFeedbackEvent.cs
- RemoveFromCollection.cs
- RectKeyFrameCollection.cs
- IconHelper.cs
- XhtmlConformanceSection.cs
- MarshalByRefObject.cs
- SqlClientWrapperSmiStream.cs
- DataTransferEventArgs.cs
- ApplicationId.cs
- Message.cs
- PopOutPanel.cs
- SoapIgnoreAttribute.cs
- BitmapEffectState.cs
- ThicknessAnimationBase.cs
- EmptyEnumerable.cs
- TextTreeText.cs
- MdImport.cs
- ExplicitDiscriminatorMap.cs
- JapaneseLunisolarCalendar.cs
- Parsers.cs
- ObjectStateEntryDbDataRecord.cs
- DataSetViewSchema.cs
- DocumentAutomationPeer.cs
- DesignTimeType.cs
- HatchBrush.cs
- SingleQueryOperator.cs
- ADMembershipUser.cs
- WebPartConnectionsCancelVerb.cs
- ViewRendering.cs
- DataReaderContainer.cs
- File.cs
- UserControl.cs
- DesignerToolStripControlHost.cs
- TokenFactoryFactory.cs
- PathFigure.cs
- SeekableMessageNavigator.cs
- ActivationArguments.cs
- DependencyPropertyConverter.cs
- InternalSafeNativeMethods.cs
- UriTemplateEquivalenceComparer.cs
- WindowInteractionStateTracker.cs
- XmlArrayItemAttribute.cs
- BitmapFrameDecode.cs
- ProcessHost.cs
- TextSearch.cs
- FontCacheLogic.cs
- UiaCoreApi.cs
- SelectionWordBreaker.cs
- FontStretch.cs
- CodeAssignStatement.cs
- DateTime.cs
- IsolatedStorageFilePermission.cs
- FormsAuthentication.cs
- XPathAxisIterator.cs
- CachingHintValidation.cs
- FederatedMessageSecurityOverHttpElement.cs
- MatrixCamera.cs
- SerialPinChanges.cs
- RbTree.cs
- DocumentPageHost.cs
- AsyncStreamReader.cs
- sitestring.cs
- odbcmetadatacolumnnames.cs
- DSASignatureDeformatter.cs
- FunctionDefinition.cs
- DynamicValidatorEventArgs.cs
- X509InitiatorCertificateServiceElement.cs
- StrokeSerializer.cs
- ServiceCredentialsElement.cs
- InvalidTimeZoneException.cs
- OdbcHandle.cs
- Constraint.cs
- IsolatedStorageFile.cs
- ApplicationException.cs
- DataObjectSettingDataEventArgs.cs
- HierarchicalDataTemplate.cs
- TypeInitializationException.cs
- WebPartConnectionsConnectVerb.cs
- IdleTimeoutMonitor.cs
- AppDomainUnloadedException.cs
- UpDownBase.cs
- DBBindings.cs
- CmsUtils.cs
- OracleParameterCollection.cs