Edit

Share via


HwndSourceParameters.SetSize(Int32, Int32) Method

Definition

Sets the values that are used for the window size of the HwndSource.

public:
 void SetSize(int width, int height);
public void SetSize (int width, int height);
member this.SetSize : int * int -> unit
Public Sub SetSize (width As Integer, height As Integer)

Parameters

width
Int32

The width of the window, in device pixels.

height
Int32

The height of the window, in device pixels.

Remarks

Unlike most methods that take rectangle screen-region measures in Windows Presentation Foundation (WPF), you specify this window size in device pixels, not in the typical device-independent units. If you need to size your window to its content, set SizeToContent to true.

Do not pass 0 (zero) for either the width or height parameters. Although the method eventually succeeds even if you do pass 0, a substantial performance penalty occurs.

Applies to

See also