HwndSourceParameters.SetSize(Int32, Int32) 方法

定義

設定用於 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)

參數

width
Int32

視窗的寬度 (以裝置像素為單位)。

height
Int32

視窗的高度 (以裝置像素為單位)。

備註

不同于Windows Presentation Foundation (WPF) 中採用矩形螢幕區域量值的大部分方法,您會以裝置圖元指定此視窗大小,而不是在一般裝置無關的單位中。 如果您需要將視窗的大小調整為其內容,請將 設定 SizeToContenttrue

請勿針對 widthheight 參數傳遞 0 (零) 。 雖然方法最終會成功,即使您通過 0,仍會發生顯著的效能負面影響。

適用於

另請參閱