FontConverter.FontNameConverter.CanConvertFrom(ITypeDescriptorContext, Type) FontConverter.FontNameConverter.CanConvertFrom(ITypeDescriptorContext, Type) FontConverter.FontNameConverter.CanConvertFrom(ITypeDescriptorContext, Type) FontConverter.FontNameConverter.CanConvertFrom(ITypeDescriptorContext, Type) Method

定義

判斷這個轉換子是否可以將指定來源型別中的物件轉換成轉換子的原生型別。Determines if this converter can convert an object in the given source type to the native type of the converter.

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

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 ITypeDescriptorContext ITypeDescriptorContext

ITypeDescriptorContext,可以用來擷取環境的其他資訊,而這個轉換子就是從這個環境叫用的。An ITypeDescriptorContext that can be used to extract additional information about the environment this converter is being invoked from. 這可能是 null,所以您要隨時檢查。This may be null, so you should always check. 此外,內容物件上的屬性可能會傳回 nullAlso, properties on the context object may return null.

sourceType
Type Type Type Type

要轉換的來源型別。The type you wish to convert from.

傳回

如果這個轉換器可以執行轉換,則為 true,否則為 falsetrue if the converter can perform the conversion; otherwise, false.

適用於

另請參閱