Export (0) Print
Expand All

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
public Point GetPoint (
	PointProperty prop
public function GetPoint (
	prop : PointProperty
) : Point
Not applicable.



One of the PointProperty values that specifies which property value to retrieve for the current visual style element.

Return Value

A Point that contains the value of the property specified by the prop parameter for the current visual style element.

Exception typeCondition


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)

    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 =

        // Get the height of the window caption.
        if (SetRenderer(windowElements["windowCaption"]))
            captionHeight = renderer.GetPartSize(g,

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

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

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2014 Microsoft