VisualStyleRenderer.GetPoint(PointProperty) Método

Definición

Devuelve el valor de la propiedad de punto especificada para el elemento de estilo visual actual.

C#
public System.Drawing.Point GetPoint(System.Windows.Forms.VisualStyles.PointProperty prop);

Parámetros

prop
PointProperty

Uno de los valores de PointProperty que especifica qué valor de propiedad se va a recuperar para el elemento de estilo visual actual.

Devoluciones

Point que contiene el valor de la propiedad especificada por el parámetro prop para el elemento de estilo visual actual.

Excepciones

prop no es uno de los valores de PointProperty .

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar el GetPoint método en un control personalizado para obtener el desplazamiento del botón Cerrar de la ventana en relación con la esquina superior derecha de la barra de título. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la información general de la VisualStyleRenderer clase.

C#
// Get the sizes and offsets for the window parts as specified  
// by the visual style.
private void GetPartDetails()
{
    // Do nothing further if visual styles are not enabled.
    if (!Application.RenderWithVisualStyles)
    {
        return;
    }

    using (Graphics g = this.CreateGraphics())
    {
        // Get the size and offset of the close button.
        if (SetRenderer(windowElements["windowClose"]))
        {
            closeButtonSize =
                renderer.GetPartSize(g, ThemeSizeType.True);
            closeButtonOffset =
                renderer.GetPoint(PointProperty.Offset);
        }

        // Get the height of the window caption.
        if (SetRenderer(windowElements["windowCaption"]))
        {
            captionHeight = renderer.GetPartSize(g,
                ThemeSizeType.True).Height;
        }

        // Get the thickness of the left, bottom, 
        // and right window frame.
        if (SetRenderer(windowElements["windowLeft"]))
        {
            frameThickness = renderer.GetPartSize(g,
                ThemeSizeType.True).Width;
        }

        // Get the size of the resizing gripper.
        if (SetRenderer(windowElements["statusGripper"]))
        {
            gripperSize = renderer.GetPartSize(g,
                ThemeSizeType.True);
        }
    }
}

Comentarios

Los estilos visuales usan un conjunto de valores de punto para describir algunas propiedades de los elementos definidos por un estilo. Estos valores encapsulan PointProperty estas propiedades.

Se aplica a

Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10