HwndSourceParameters.SetSize(Int32, Int32) 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
设置用于 HwndSource 的窗口大小的值。
public:
void SetSize(int width, int height);
C#
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
。
不要为 width
或 height
参数传递 0 (零) 。 尽管即使通过 0,该方法最终也会成功,但会大幅降低性能。
产品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |