如何在c#中找到win表单的保证金百分比。 [英] How to find the margin percentage of a win form in c#.

查看:69
本文介绍了如何在c#中找到win表单的保证金百分比。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个胜利形式的应用程序,但问题是当它是完整大小的.....控件得到所有这里和那里.........并做了一些研究,发现它需要写百分比的边距,但我找不到怎么做...........请帮帮我......请告诉我如何找到边距百分比..... .....提前致谢...........









问候,

Ahsan Naveed

I wanted to make a win forms app but the problem is when it is full sized.....The controls get all here and there.........and made some research and found out that it requires to write the margins in percentage but i could not find how to do it...........please help me......please tell me how to find the margins percentage..........Thanks in advance...........




Regards,
Ahsan Naveed

推荐答案

Winforms在百分比中不起作用 - 它以像素为单位工作没有控制宽度或高度可以表示为其容器的百分比。我怀疑你的表弟正在考虑网页设计,其中CSS允许你以百分比的形式指定这些东西。



您要么使用容器Dock和Anchor属性或手动重新调整Form.Resize事件中的控件(很多工作,很少产生好的结果)。



另一种方法是使用WPF代替WinForms,其中Grid ColumnDefinition.Width可以通过在定义中使用*以变量(和有效百分比)术语表示。然而,WPF有一个非常大的学习曲线,这可能使你无法使用。
Winforms does not work in percentages - it works in pixels and no control width or height can be expressed as a percentage of its container. I suspect your cousin is thinking of web design, where CSS allows you to specify these things in percentage terms.

You are either down to using the container Dock and Anchor properties or manually re-sizing controls in the Form.Resize event (a lot of work, and rarely produces a good result).

The alternative is to use WPF instead of WinForms, where the Grid ColumnDefinition.Width can be expressed in variable (and effectively percentage) terms by using a "*" in the definition. WPF has a very large learning curve however, which may make it unfeasible for you to use.


这篇关于如何在c#中找到win表单的保证金百分比。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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