Califique este contenido
Contraer todo/Expandir todo Contraer todo
Esta página es específica de
Microsoft Visual Studio 2008/.NET Framework 3.5

Hay además otras versiones disponibles para:
Biblioteca de clases de .NET Framework
PointConverter (Clase)

Actualización: noviembre 2007

Convierte objetos Point de un tipo de datos en otro. Se tiene acceso a esta clase mediante el objeto TypeDescriptor.

Espacio de nombres:  System.Drawing
Ensamblado:  System.Drawing (en System.Drawing.dll)
Visual Basic (Declaración)
Public Class PointConverter _
    Inherits TypeConverter
Visual Basic (Uso)
Dim instance As PointConverter
C#
public class PointConverter : TypeConverter
Visual C++
public ref class PointConverter : public TypeConverter
J#
public class PointConverter extends TypeConverter
JScript
public class PointConverter extends TypeConverter

En el siguiente ejemplo de código se muestra cómo usar PointConverter y el operador Subtraction. Este ejemplo se aplica a un formulario Windows Forms. Pegue el código en un formulario y llame al método ShowPointConverter en el momento de controlar el evento Paint del formulario, pasando e como PaintEventArgs.

Visual Basic
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
C#
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);
}
Visual C++
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 );
}
J#
private void ShowPointConverter(PaintEventArgs e)
{
    // Create the PointConverter.
    PointConverter converter = new PointConverter();
    Point point1 = (Point)converter.ConvertFromString("200, 200");

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

    // Draw a line between the two points.
    e.get_Graphics().DrawLine(Pens.get_Black(), point1, point2);
} //ShowPointConverter
System..::.Object
  System.ComponentModel..::.TypeConverter
    System.Drawing..::.PointConverter
Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

.NET Framework

Compatible con: 3.5, 3.0, 2.0, 1.1, 1.0
Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2009 Microsoft Corporation. Reservados todos los derechos. Temas legales | Marcas Registradas | Declaración de privacidad
Page view tracker