This topic has not yet been rated - Rate this topic

VisualStyleRenderer.GetPoint Method

Returns the value of the specified point property for the current visual style element.

Namespace:  System.Windows.Forms.VisualStyles
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
public Point GetPoint(
	PointProperty prop
)

Parameters

prop
Type: System.Windows.Forms.VisualStyles.PointProperty
One of the PointProperty values that specifies which property value to retrieve for the current visual style element.

Return Value

Type: System.Drawing.Point
A Point that contains the value of the property specified by the prop parameter for the current visual style element.
Exception Condition
InvalidEnumArgumentException

prop is not one of the PointProperty values.

Visual styles use a set of point values to describe some properties of the elements defined by a style. These properties are encapsulated by the PointProperty values.

The following code example demonstrates how to use the GetPoint method in a custom control to get the offset of the window Close button in relation to the upper-right corner of the title bar. This code example is part of a larger example provided for the VisualStyleRenderer class overview.


// 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);
        }
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ