VisualStyleRenderer.GetPoint Method (PointProperty)


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


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

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,

.NET Framework
Available since 2.0
Return to top