缓慢的C#.NET Windows窗体调整大小时,表格有许多DropDownList控件 [英] Slowness in C#.net windows form resize when form has many dropdownlist controls

查看:123
本文介绍了缓慢的C#.NET Windows窗体调整大小时,表格有许多DropDownList控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个窗户,它被放置在一个网格(而不是一个DataGrid)和内部的许多下拉列表的形式,当我用锚=左右顶部底部和码头=填充选项在所有这些,形式调整大小沾在运行时速度慢。

I made a windows form with many dropdown list which are placed inside a grid(not a datagrid) and when I use anchor=left right top bottom and dock=fill options in all of them, the form resize gets slow on runtime.

做什么用的码头和锚的选择问题?

What's the problem with dock and anchor options?

是它形成了一个普遍的问题?它是使用.NET组件和Windows窗体的一般缺点?

Is it a general problem with forms? Is it a general disadvantage of using .net components and windows forms?

我没有对控制调整大小处理的任何自定义事件,所以这个问题是关于微软开发的控制。我应避免使用船坞=填?

I don't have any custom events handled on control resize, so the problem is about the controls Microsoft developed. Should I avoid using dock=fill?

推荐答案

这是一个正常的,它消耗的处理器在每个调整移动表格的形式调整表格布局面板这力量调整和复位子控件(下拉列表),因为有锚属性。

It's a normal that it consumes your processor as on every resize move form forms resize table layout panel which forces resize and reposition child controls (dropdowns), as there is anchor property setuped.

还有一个绝招,以避免调整时创建一个无奈的用户:

There is a trick to avoid to create a frustration for user when resizing:

使用 SuspendLayout() ResumeLayout() BeginResize() EndResize()事件处理程序。

Use SuspendLayout() and ResumeLayout() on BeginResize() and EndResize() event handlers.

在这里寻找具体的例子:

Look here for concrete example:

<一个href="http://stackoverflow.com/questions/2353381/$p$pvent-window-redraw-when-resizing-c-sharp-windows-forms">$p$pvent调整的C#Windows窗体时窗口重绘

应该为你工作。

这篇关于缓慢的C#.NET Windows窗体调整大小时,表格有许多DropDownList控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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