PointConverter Classe

Definizione

Converte un oggetto Point da un tipo di dati a un altro.

public ref class PointConverter : System::ComponentModel::TypeConverter
public class PointConverter : System.ComponentModel.TypeConverter
type PointConverter = class
    inherit TypeConverter
Public Class PointConverter
Inherits TypeConverter
Ereditarietà
PointConverter

Esempio

Nell'esempio di codice seguente viene illustrato come usare e PointConverter l'operatore Subtraction . Questo esempio è progettato per essere usato con Windows Form. Incollare questo codice in una maschera e chiamare il metodo quando si gestisce l'evento ShowPointConverter del Paint modulo, passando e come PaintEventArgs .

void ShowPointConverter( PaintEventArgs^ e )
{
   // Create the PointConverter.
   System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( Point::typeid );
   Point point1 =  *dynamic_cast<Point^>(converter->ConvertFromString( "200, 200" ));

   // Use the subtraction operator to get a second point.
   Point point2 = point1 - System::Drawing::Size( 190, 190 );

   // Draw a line between the two points.
   e->Graphics->DrawLine( Pens::Black, point1, point2 );
}
private void ShowPointConverter(PaintEventArgs e)
{

    // Create the PointConverter.
    System.ComponentModel.TypeConverter converter = 
        System.ComponentModel.TypeDescriptor.GetConverter(typeof(Point));

    Point point1 = (Point) converter.ConvertFromString("200, 200");

    // Use the subtraction operator to get a second point.
    Point point2 = point1 - new Size(190, 190);

    // Draw a line between the two points.
    e.Graphics.DrawLine(Pens.Black, point1, point2);
}
Private Sub ShowPointConverter(ByVal e As PaintEventArgs)

    ' Create the PointConverter.
    Dim converter As System.ComponentModel.TypeConverter = _
        System.ComponentModel.TypeDescriptor.GetConverter(GetType(Point))

    Dim point1 As Point = _
        CType(converter.ConvertFromString("200, 200"), Point)

    ' Use the subtraction operator to get a second point.
    Dim point2 As Point = Point.op_Subtraction(point1, _
        New Size(190, 190))

    ' Draw a line between the two points.
    e.Graphics.DrawLine(Pens.Black, point1, point2)
End Sub

Commenti

La PointConverter classe viene in genere usata per creare un'esperienza in fase di progettazione per i controlli con proprietà di tipo Pointe viene usato per convertire i punti in stringhe per la visualizzazione in una finestra di progettazione e per convertire le stringhe immesse in una finestra di progettazione in un Point oggetto . Accedere a questa classe tramite l'oggetto TypeDescriptor.

Costruttori

Nome Descrizione
PointConverter()

Inizializza una nuova istanza della classe PointConverter.

Metodi

Nome Descrizione
CanConvertFrom(ITypeDescriptorContext, Type)

Determina se questo convertitore può convertire un oggetto nel tipo di origine specificato nel tipo nativo del convertitore.

CanConvertFrom(Type)

Restituisce un valore che indica se questo convertitore può convertire un oggetto del tipo specificato nel tipo di questo convertitore.

(Ereditato da TypeConverter)
CanConvertTo(ITypeDescriptorContext, Type)

Ottiene un valore che indica se questo convertitore può convertire un oggetto nel tipo di destinazione specificato utilizzando il contesto.

CanConvertTo(Type)

Restituisce un valore che indica se questo convertitore può convertire l'oggetto nel tipo specificato.

(Ereditato da TypeConverter)
ConvertFrom(ITypeDescriptorContext, CultureInfo, Object)

Converte l'oggetto specificato in un Point oggetto .

ConvertFrom(Object)

Converte il valore specificato nel tipo di questo convertitore.

(Ereditato da TypeConverter)
ConvertFromInvariantString(ITypeDescriptorContext, String)

Converte la stringa specificata nel tipo di questo convertitore, utilizzando le impostazioni cultura invarianti e il contesto specificato.

(Ereditato da TypeConverter)
ConvertFromInvariantString(String)

Converte la stringa specificata nel tipo di questo convertitore, utilizzando le impostazioni cultura invarianti.

(Ereditato da TypeConverter)
ConvertFromString(ITypeDescriptorContext, CultureInfo, String)

Converte il testo specificato in un oggetto utilizzando il contesto e le informazioni sulle impostazioni cultura specificate.

(Ereditato da TypeConverter)
ConvertFromString(ITypeDescriptorContext, String)

Converte il testo specificato in un oggetto utilizzando il contesto specificato.

(Ereditato da TypeConverter)
ConvertFromString(String)

Converte il testo specificato in un oggetto .

(Ereditato da TypeConverter)
ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type)

Converte l'oggetto specificato nel tipo specificato.

ConvertTo(Object, Type)

Converte l'oggetto valore specificato nel tipo specificato utilizzando gli argomenti .

(Ereditato da TypeConverter)
ConvertToInvariantString(ITypeDescriptorContext, Object)

Converte il valore specificato in una rappresentazione di stringa invariante delle impostazioni cultura, utilizzando il contesto specificato.

(Ereditato da TypeConverter)
ConvertToInvariantString(Object)

Converte il valore specificato in una rappresentazione di stringa invariante delle impostazioni cultura.

(Ereditato da TypeConverter)
ConvertToString(ITypeDescriptorContext, CultureInfo, Object)

Converte il valore specificato in una rappresentazione di stringa, utilizzando il contesto e le informazioni sulle impostazioni cultura specificate.

(Ereditato da TypeConverter)
ConvertToString(ITypeDescriptorContext, Object)

Converte il valore specificato in una rappresentazione di stringa, utilizzando il contesto specificato.

(Ereditato da TypeConverter)
ConvertToString(Object)

Converte il valore specificato in una rappresentazione di stringa.

(Ereditato da TypeConverter)
CreateInstance(IDictionary)

Ricrea un Object dato un set di valori di proprietà per l'oggetto.

(Ereditato da TypeConverter)
CreateInstance(ITypeDescriptorContext, IDictionary)

Crea un'istanza di questo tipo in base a un set di valori di proprietà per l'oggetto .

Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetConvertFromException(Object)

Restituisce un'eccezione da generare quando non è possibile eseguire una conversione.

(Ereditato da TypeConverter)
GetConvertToException(Object, Type)

Restituisce un'eccezione da generare quando non è possibile eseguire una conversione.

(Ereditato da TypeConverter)
GetCreateInstanceSupported()

Restituisce un valore che indica se la modifica di un valore in questo oggetto richiede una chiamata al metodo CreateInstance(IDictionary) per creare un nuovo valore.

(Ereditato da TypeConverter)
GetCreateInstanceSupported(ITypeDescriptorContext)

Determina se la modifica di un valore in questo oggetto deve richiedere una chiamata a CreateInstance(ITypeDescriptorContext, IDictionary) per creare un nuovo valore.

GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetProperties(ITypeDescriptorContext, Object, Attribute[])

Recupera il set di proprietà per questo tipo. Per impostazione predefinita, un tipo non restituisce alcuna proprietà.

GetProperties(ITypeDescriptorContext, Object)

Restituisce una raccolta di proprietà per il tipo di matrice specificato dal parametro value, utilizzando il contesto specificato.

(Ereditato da TypeConverter)
GetProperties(Object)

Restituisce un insieme di proprietà per il tipo di matrice specificato dal parametro value.

(Ereditato da TypeConverter)
GetPropertiesSupported()

Restituisce un valore che indica se l'oggetto supporta le proprietà.

(Ereditato da TypeConverter)
GetPropertiesSupported(ITypeDescriptorContext)

Determina se questo oggetto supporta le proprietà. Per impostazione predefinita, tale valore è false.

GetStandardValues()

Restituisce una raccolta di valori standard dal contesto predefinito per il tipo di dati per cui è progettato questo convertitore di tipi.

(Ereditato da TypeConverter)
GetStandardValues(ITypeDescriptorContext)

Restituisce una raccolta di valori standard per il tipo di dati che questo convertitore di tipi è progettato per quando viene fornito con un contesto di formato.

(Ereditato da TypeConverter)
GetStandardValuesExclusive()

Restituisce un valore che indica se l'insieme di valori standard restituiti da GetStandardValues() è un elenco esclusivo.

(Ereditato da TypeConverter)
GetStandardValuesExclusive(ITypeDescriptorContext)

Restituisce un valore che indica se la raccolta di valori standard restituiti da GetStandardValues() è un elenco esclusivo di valori possibili, utilizzando il contesto specificato.

(Ereditato da TypeConverter)
GetStandardValuesSupported()

Restituisce un valore che indica se l'oggetto supporta un set standard di valori che è possibile selezionare da un elenco.

(Ereditato da TypeConverter)
GetStandardValuesSupported(ITypeDescriptorContext)

Restituisce un valore che indica se l'oggetto supporta un set standard di valori che è possibile selezionare da un elenco, utilizzando il contesto specificato.

(Ereditato da TypeConverter)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
IsValid(ITypeDescriptorContext, Object)

Restituisce un valore che indica se l'oggetto valore specificato è valido per questo tipo e per il contesto specificato.

(Ereditato da TypeConverter)
IsValid(Object)

Restituisce un valore che indica se l'oggetto valore specificato è valido per questo tipo.

(Ereditato da TypeConverter)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
SortProperties(PropertyDescriptorCollection, String[])

Ordina una raccolta di proprietà.

(Ereditato da TypeConverter)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Si applica a