在调用Show之前获取Window的大小 [英] Get size of Window before calling Show
问题描述
我想在调用Show()之前获取窗口的大小.我尝试在其上调用Measure()和Arrange(),但在这些调用之后DesiredSize为0.
I want to get the size of a window before Show() is called on it. I've tried calling Measure() and Arrange() on the it, but DesiredSize is 0 after those calls.
非常感谢,
亚当.
=============
Adam.
=============
推荐答案
HI Adam,
HI Adam,
我可能出错了,因为不确定我是否正确理解了您的问题.
I've probably got this wrong as im not sure if I understandyour issue correctly.
但是如果我在我的代码中这样做
But if I do this in my code
Window5 m =新的Window5();
Window5 m = new Window5();
双倍高度= m.高度;
double height = m.Height;
双倍宽度= m.Width;
double width = m.Width;
m.Show();
m.Show();
在调用show方法之前,我先获得了宽度和高度.
I get the width and height before calling the show method.
如果这不是您想要的,那么您实际上追求的是什么?
If this is not what you want, what is it that you are actually after?
这篇关于在调用Show之前获取Window的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!