如何让win form应用程序响应? [英] How to make win form application responsive ?

查看:80
本文介绍了如何让win form应用程序响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经开发了使用Windows应用程序的POS系统,但是需要使其响应,这是不可能的。



我们有另一种选择来转换它进入WPF,但需要更多时间。



我尝试过:



任何人都有建议根据屏幕分辨率调整windows窗体应用程序。

We have developed POS system using windows application ,but there is a requirement to make it responsive ,which is not possible.

we have another option to convert it into WPF but it will require more time.

What I have tried:

any one have suggestion to make windows form application which adjust according to screen resolution.

推荐答案

差不多,你不能让WinForms应用程序很好地响应不同的分辨率:这是可能的,但这是一项繁重的工作,当你完成时可能不会太精彩。

问题是虽然所有控件都可以锚定和停靠,所以它们会自动调整大小,这对控件中的文本没有任何影响:所以你最终会得到一个中间带有微小不可读文本的大按钮,或者一个中间有大量不可读文本的小按钮。



虽然有可能通过处理每个控件的Resize事件并根据新的显示区域计算出要使用的字体大小来解决这个问题,这不是一件容易的事情,通常需要相当多的试验和错误,再加上奇怪的软糖因素。处理奇怪的情况。



你可以做到,但这是认真的工作 - WPF处理它好多了!



另一种解决方案是重新设计你的用户界面,以便以与Visual Studio相同的方式处理多种分辨率:一个中央工作空间,面板中的所有工具都可以浮动或停靠在边缘。但对于POS系统,这可能不实用!
Pretty much, you can't make a WinForms app respond well to different resolutions: it's possible, but it's a heavy amount of work and probably won't be too wonderful when you are finished.
The problem is that although all controls can be Anchored and Docked so they resize automatically, that doesn't have any effect on text within the controls: so you end up with a large button with tiny unreadable text in the middle, or a tiny button with huge unreadable text in the middle.

While it's possible to get round this by handling the Resize event for each control and working out what font size to use based on the new display area, that's not trivial and generally takes a fair amount of trial and error, plus the odd "fudge factor" thrown in to deal with strange cases.

You can do it, but it's serious work - WPF handles it a lot better!

The other solution is to redesign your UI to work well at multiple resolutions in the same way tat Visual Studio does: a central "work space" with all the tools in panels which float or dock round the edges. But for a POS system, that probably isn't practical!


您可以评估TableLayoutPanel并确保将列和行定义为百分比而不是绝对值。您还需要为单个控件进行对接和锚定。



如果您正在寻找从水平到垂直切换的布局,那么您将需要使用表单的大小调整事件。
You can evaluate TableLayoutPanel and ensure that columns and rows are defined as a percentage instead of absolute values. You would also need to work out docking and anchoring for individual controls.

If you are looking for layout to switch from, say, horizontal to vertical, then you will need to work with resizing event of the form.


这篇关于如何让win form应用程序响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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