ImageFormatConverter.ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type) Método
Definição
Converte o objeto especificado no tipo especificado.Converts the specified object to the specified type.
public:
override System::Object ^ ConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value, Type ^ destinationType);
public override object ConvertTo (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType);
public override object ConvertTo (System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, Type destinationType);
override this.ConvertTo : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj * Type -> obj
Public Overrides Function ConvertTo (context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object
Parâmetros
- context
- ITypeDescriptorContext
Um contexto do formatador.A formatter context. Esse objeto pode ser usado para obter mais informações sobre o ambiente do qual este conversor está sendo chamado.This object can be used to get more information about the environment this converter is being called from. Isso pode ser null, portanto, você sempre deve verificar.This may be null, so you should always check. Além disso, as propriedades no objeto de contexto também podem retornar null.Also, properties on the context object may also return null.
- culture
- CultureInfo
Um objeto CultureInfo que especifica as convenções de formatação usadas para uma determinada cultura.A CultureInfo object that specifies formatting conventions for a particular culture.
- value
- Object
O objeto a ser convertido.The object to convert.
- destinationType
- Type
O tipo no qual converter o objeto.The type to convert the object to.
Retornos
O objeto convertido.The converted object.
Exceções
Não foi possível concluir a conversão.The conversion cannot be completed.
destinationType é null.destinationType is null.
Comentários
O ImageFormatConverter converte de e para formatos de imagem conhecidos, conforme especificado na ImageFormat classe.The ImageFormatConverter converts to and from known image formats, as specified in the ImageFormat class.
A conversão de tipo mais comum é de e para um tipo de cadeia de caracteres.The most common type conversion is to and from a string type. A implementação padrão chama o ToString método do objeto se o objeto for válido e se o tipo de destino for string .The default implementation calls the ToString method of the object if the object is valid and if the destination type is string. Se esse método não puder converter o objeto especificado para o tipo de destino especificado, ele lançará uma NotSupportedException exceção.If this method cannot convert the specified object to the specified destination type, it throws a NotSupportedException exception.