窗口上的WPF布局 [英] WPF layout on a Window

查看:71
本文介绍了窗口上的WPF布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF Windows上有几个列表框,在表单上设置了Height="Auto" Width="Auto"

I have a couple of listboxes on a WPF Windows, with Height="Auto" Width="Auto" set on the form

在不同的分辨率下,表单的大小完美匹配,但是问题是,当我按最大化按钮时,在调整表单大小时会看到一个粗的"Black L".我已经在许多WPF应用程序上看到了这一点,但到目前为止还不必解决问题.

The form sizes perfectly on different resolutions, but the problem is that when I press the maximise button a thick "Black L" is visible while the form resizes. I have seen this on quite a few WPF applications, but not had to solve the problem till now.

有没有一种方法可以对窗口进行DoubleBuffer处理,或者在调整窗体上的控件大小时在WPF中调用SuspendLayout()?我该如何摆脱这个丑陋的黑色L?

Is there a way to DoubleBuffer the Window, or call SuspendLayout() in WPF while the controls on the form are resized? How can I get rid of this ugly black L?

推荐答案

引用最近的 Hanselminutes :

伊恩·格里菲斯(Ian Griffiths):...有win32提示 这是一个普通的win32消息循环,并且WPF池消息 从那,把它们放在自己的 提示,然后自己处理 美好的时光,部分是因为它想 能够对事件进行重新排序 进来.它将优先考虑某些 以上输入处理的事情,对于 例子,顺便说一句,这就是为什么 你会得到稍微怪异的重涂 处理WPF应用程序的大小调整, 您可能已经注意到您得到了一点 出现一些空白 调整窗口大小时暂时 这是因为它承认 在实际事件发生之前重新调整事件大小 用它做任何事情,然后 油漆稍微不同步 与通常的东西.所以那里 是一个Win32消息队列,但不是 实际上是WPF中的主要消息队列 这就是各种各样的实现 详细信息调度员试图隐藏 尽可能多地了解它.

Ian Griffiths: ... There's the win32 cue which is an ordinary win32 message loop, and WPF pools messages off of that and puts them on it's own cue and then deal with it on it's own sweet time, partly because it wants to be able to reorder the events as they come in. It will prioritize certain things above input processing, for example, and that, by the way, is why you get the slightly bizarre repaint handling on resizing WPF applications, you may have noticed you get a little bit of blank space appearing temporarily when you resize a window it's because it's acknowledging the resize event before it actually really does anything with it and then the paints happen slightly out of sync with what's normally there. So there is a win32 message queue but it's not actually the main message queue in WPF and that‘s all sort of implementation details the dispatcher tries to hide as much about it as possible.

这似乎与您的问题有关,尽管我不知道完整的解决方案. 也许,您应该尝试更改一些Dispatcher优先级?

It seems relevant to your problem, though I'm not aware of a complete solution. Maybe, you should try to change some Dispatcher priorities?

这篇关于窗口上的WPF布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆