根据LCD尺寸动态设置表单大小 [英] Set form size dynamically according to LCD size

查看:63
本文介绍了根据LCD尺寸动态设置表单大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我是编程世界的重要人物.....





我的开发PC的LCD尺寸是17英寸。我开发的应用程序适合我的LCD。每个控件放在适当的位置和整个屏幕区域被使用。



问题是这个应用程序的最终用户有不同的屏幕尺寸,即17,19,21,15等





最终用户(屏幕尺寸大于17)要求使用所有屏幕区域扩散控制和增加控制的大小



最终用户(屏幕尺寸小于17)要求申请表格适合屏幕而不是滚动条。



请引导并分享有用的链接(如果有的话)。 由于只有屏幕尺寸,我不想为所有最终用户编写单独的代码。





提前谢谢。

Dear all,

I'm biggenner in programming world.....


My development PC's LCD size is 17-inch. I develop application which fits to my LCD. Every controls is placed at proper place and whole screen area is used.

Problem is that end-users of this application has different screen size i.e. 17, 19, 21, 15 and e.t.c.


End-users (having screen size greater than 17) demanded to use all screen area by spreading controls and increasing size of controls

while end-users (having screen size less than 17) demanded that application form should be fit on screen instead of scroll bars.

Please guide and share usefull links if any. I don't want to write separate code for all end-users due to only screen size.


Thanks in advance.

推荐答案

基本上,你不能。这不是屏幕的物理尺寸问题,而是显示应用程序的分辨率:可以从(比如)800比600到2,560比1,600不等 - 这不仅仅是分辨率的变化,而是在形状上也是如此。由于你的表单是以像素的形式定义的(因为它们总是如此),适合你的屏幕可能不适合另一个 - 实际上它不太可能:我有两个22显示器,一个肖像和一个风景,所以你应用程序将必须在我的左侧显示器上应对1080到1920,在右边显示1680到1050.



除非您的应用程序像VS一样组织,具有中央工作区域和工具等边缘,你不能轻易(或甚至合理地)期望任何东西,甚至只是这两个。



你可以做一些事情,使用Anchor和Dock属性,特别是如果你在面板中将控件组合在一起并锚定并将面板停靠在表单上,​​但是严肃地说,除非你的应用程序是从头开始设计好以应对这种事情,否则它看起来永远不会好看。



另一种选择是切换到更好地处理它的WPF - 但即便如此,它更像是PITA而不是它的属lly值得。
Basically, you can't. It's not the physical size of the screen that is the problem, but rather the resolution at which you application is being displayed: with can vary from (say) 800 by 600 to 2,560 by 1,600 - which is not just a change in resolution, but in shape as well. Since your form is defined (as they always are) in terms of pixels, what fits your screen may not fit another - in fact it's very unlikely to: I have two 22" monitors, one portrait, and one landscape, so you application would have to cope with 1080 by 1920 on my left hand monitor, and 1680 by 1050 on my right.

Unless your application is organised like VS, with a central "work area" and tools etc round the edges, you can't easily (or even reasonably) expect anything to fit even just both of those.

You can do somethings, using the Anchor and Dock properties, particularly if you group controls together in panels and anchor and dock the panels to the form, but seriously, unless your application is well designed from scratch to cope with this kind of thing, it's never going to look good.

The other option is to switch over to WPF, which handles it better - but even then, it's rather more of a PITA than it's generally worth.


考虑以下HTML,没有任何Javascript和CSS:

Consider the following HTML, without any Javascript and CSS:
<html>
<body>
<h1>This is the example of fluid HTML</h1>
    <p>Isn't that obvious: if you resize the browser window, this content is shown properly and remains readable for almost all sizes? Conclusion? Keep it simple&hellip;
</body>
</html>

此示例演示:如果您保持一切简单,则不存在此类问题。您可以通过添加样式来创建此问题,甚至可以使用绝对定位和其他内容。难怪你的布局不能容忍浏览器窗口大小的变化。请注意屏幕尺寸不是唯一因素。用户可以随时更改浏览器窗口的大小。



这并不意味着保持设计简单,您无法创建外观漂亮的网页。这实际上是一门大艺术:网页设计。



在许多其他方面,你可能想拥抱液体,流体和弹性设计,所有参考过去的答案:

http://www.codeproject.com/Answers/537436/Webpage-screen-resolution-Cross-Browser-Cross-Plat.aspx#answer2

http://www.codeproject.com/Answers/578125/ToplusGetplusScreenplusresolution#answer1。



-SA

This example demonstrates: if you keep everything simple, such problems don't exist. You create this problem by adding your styles, maybe even absolute positioning and other things. No wonder your layout cannot tolerate change in the browser window size. Pay attention that the screen size is not the only factor. The user can change the size of the browser window anytime.

It does not mean that keeping the design simple you cannot create good looking Web pages. This is actually a big art: Web design.

Among many other things, you may want to embrace liquid, fluid and elastic design, all referenced to past answers:
http://www.codeproject.com/Answers/537436/Webpage-screen-resolution-Cross-Browser-Cross-Plat.aspx#answer2
http://www.codeproject.com/Answers/578125/ToplusGetplusScreenplusresolution#answer1.

—SA


这篇关于根据LCD尺寸动态设置表单大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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