如何加速 .NET winforms 渲染 [英] How to speed up .NET winforms rendering

查看:41
本文介绍了如何加速 .NET winforms 渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列表单并在它们之间导航.

I have a series of forms and navigate between them.

每个表单都有一组控件,我从 SQLite 数据库加载属性,这是一个长(大约 1 秒)的操作,不会给用户最好的感觉,因为表单正在逐渐绘制.

Each form has a set of controls for which I load properties from SQLite database and this is the long (about 1s) operation that doesn't give users the best feeling because the form is gradually being drawn.

我不太介意延迟,但我希望在加载所有数据时绘制表单.我想避免新线程,因为这会导致跨线程操作问题.

I don't quite mind the delay but I'd like the form to be drawn when all data is loaded. I'd like to avoid new threads because this would result in cross-thread operation issues.

除了通过缓存加载的数据来加速整个应用程序之外,还有什么好的解决方案吗?

Is there any good solution apart from speeding the whole application up by caching the loaded data?

推荐答案

有一种简单的方法可以提高许多控件的感知性能,尤其是数据密集型控件,如列表视图、列表框、组合框等.

There is a simple way to speed up perceived performance of many controls, especially data intensive ones like listviews, listboxes, combo boxes etc.

在填充它们之前调用 BeginUpdate() 方法,完成后调用 EndUpdate().这将禁用控件的重绘,直到您完成用数据填充它.

Before you populate them call the BeginUpdate() method and when done call the EndUpdate(). This disables the redrawing of the control until you're done populating it with data.

这篇关于如何加速 .NET winforms 渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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