VisualStyleHelperGetPartSize Method

Gets the part size of a themed element.

Definition

Namespace: KGySoft.WinForms
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public static Size GetPartSize(
	string className,
	IntPtr hwnd,
	IDeviceContext dc,
	int part,
	int state,
	bool actualSize
)

Parameters

className  String
The class name of the visual style element.
hwnd  IntPtr
A window handle to get the size of a specific control; otherwise, IntPtr.Zero.
dc  IDeviceContext
The device context to use for the operation.
part  Int32
An integer identifier that specifies the part to calculate the size of.
state  Int32
An integer identifier that specifies the state of the part.
actualSize  Boolean
to get the actual size of the themed glyph; to get the possibly scaled size when the part is drawn. Can make a difference with high DPI settings.

Return Value

Size
A Size structure that receives the dimensions of the specified part.

Remarks

If hwnd is not IntPtr.Zero, the result can consider the scaling of a particular control when the application has per-monitor DPI awareness.

For className, part and state you can use the predefined nested classes of the VisualStyleElement class. For more information see also the Parts and States page.

See Also