Windows窗体调整大小笔记本电脑,迷你笔记本电脑和桌面 [英] windows form resize in laptop, mini-laptop and desktop

查看:195
本文介绍了Windows窗体调整大小笔记本电脑,迷你笔记本电脑和桌面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#.net中调整窗体形状的大小。当使用桌面尺寸是好脚但是当使用笔记本电脑尺寸大到屏幕使用滚动和迷你笔记本电脑是屏幕工作是非常困难与否。如何删除此问题.....

解决方案

如果您使用的是Windows窗体,我建议您使用Windows窗体控件的Anchor和Dock属性。 br />
以下是一个示例 - 使用Anchor和Dock属性 [ ^ ]。

与WPF相比,Windows Forms在不同屏幕尺寸上动态调整大小的能力非常有限;使用Win Forms提供的典型控件,您可能会惊讶于他们的内部元素......您无法修改......不能扩展。



正如Sri Abhnav指出,您可以使用Forms / Controls的Dock和Anchor属性来尝试在不同大小和不同分辨率的屏幕上获得UI元素的合理一致定位。您还可以使用控件的边距和填充属性来帮助创建一致的定位。



您还可以使用Windows窗体中的屏幕对象来获取实际值表格总面积的屏幕尺寸,或其'DisplayRectangle(不包括表格标题,边框的内容区域)。



基于读取屏幕大小在运行时,您可以根据需要对UI元素进行一些缩放。请注意(根据我的经验)尝试扩展每个UI元素通常最终会成为灾难。



我鼓励您构建基本布局使用面板和/或(如果适用)SplitContainer,TableLayoutPanel等。



根据需要设置面板​​的自动滚动属性。


亲爱的khan_parvez

我强烈建议你仔细阅读: https://msdn.microsoft.com/en-us/library/windows/apps/dn958435.aspx [ ^ ]



我希望它能给出你有些想法。


How to Resize window form in c#.net. when using desktop size is feet good but when using in laptop size is large out to screen using scroll and mini laptop is out to screen working is very difficult or not. how is remove this problem.....

解决方案

If you are using windows forms, I would suggest you to use Anchor and Dock properties of windows form controls.
Here is an example - Working with Anchor and Dock properties[^].


Compared to WPF, Windows Forms is very limited in its abilities to re-size dynamically on different screen-sizes; using the typical Controls provided by Win Forms, you may be surprised at how their internal elements ... which you can't modify ... don't "scale" well.

As Sri Abhnav points out, you can use the Dock and Anchor properties of Forms/Controls to try and get reasonably consistent positioning of your UI elements on different size, and different resolution, screens. You can also use the 'Margin and 'Padding properties of Controls to help create consistent positioning.

You can also use the 'Screen object in Windows Forms to get the actual screen-size of both the total area of the Form, or its 'DisplayRectangle (content area exclusive of Form Header, border).

Based on reading the screen-size at run-time, you could do some scaling of your UI elements as needed. Note that (in my experience) attempts to scale every UI elements usually end up as a disaster.

I encourage you to construct your basic layout using Panels, and/or (if appropriate) SplitContainer, TableLayoutPanel, etc.

Set the auto-scroll properties of the Panels as necessary.


Dear khan_parvez
I would strongly recommend to read through: https://msdn.microsoft.com/en-us/library/windows/apps/dn958435.aspx[^]

I hope it will give you some ideas.


这篇关于Windows窗体调整大小笔记本电脑,迷你笔记本电脑和桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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