IconConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定义

使用指定的上下文确定此 IconConverter 是否能够将指定类型的实例转换为 IconDetermines whether this IconConverter can convert an instance of a specified type to an Icon, using the specified context.

public:
 override bool CanConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ sourceType);
public override bool CanConvertFrom (System.ComponentModel.ITypeDescriptorContext context, Type sourceType);
override this.CanConvertFrom : System.ComponentModel.ITypeDescriptorContext * Type -> bool
Public Overrides Function CanConvertFrom (context As ITypeDescriptorContext, sourceType As Type) As Boolean

参数

context
ITypeDescriptorContext

一个 ITypeDescriptorContext,用于提供格式上下文。An ITypeDescriptorContext that provides a format context.

sourceType
Type

一个 Type,它指定要转换的类型。A Type that specifies the type you want to convert from.

返回

Boolean

如果此 IconConverter 可以执行转换,则此方法返回 true;否则返回 falseThis method returns true if this IconConverter can perform the conversion; otherwise, false.

注解

true仅当 sourceType 等于字节数组时,此方法才会返回。This method returns true only if sourceType is equal to a byte array.

适用于