語言

ImageFormatConverter.CanConvertFrom(ITypeDescriptorContext, Type) 方法

定義

表示此轉換器是否能將指定來源類型中的物件轉換為轉換器原生類型。

public:
 override bool CanConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ sourceType);
public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, Type sourceType);
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

格式化器的上下文。 這個物件可以用來獲取更多關於該轉換器所來自環境的資訊。 這可能是 null,所以你應該隨時確認。 此外,上下文物件上的屬性也可能回傳 null。

sourceType
Type

你想轉換的類型。

傳回

如果該物件能執行轉換,此方法會回傳 true 。

備註

這些影像 ImageFormatConverter 會依類別 ImageFormat 中指定的方式轉換至已知影像格式。

適用於