VisualStyleRenderer.GetPoint Method
Returns the value of the specified point property for the current visual style element.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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.PointA 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); } } }
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.