码头,锚和流体布局在Windows窗体应用程序 [英] Dock, Anchor and Fluid layouts in Windows Forms Applications

查看:171
本文介绍了码头,锚和流体布局在Windows窗体应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我一直在问到重新设计的旧的应用程序我几年前写的。

So, I've been asked to redesign an old application I wrote a few years ago.

基本上,没有什么需要改变,所不同的是客户希望它是更流畅,并且它必须被全屏(没有可见的窗口)即无标题栏,只是一个无边界全屏窗口。

Basically, nothing much needs to be changed, except that the Customer wants it to be more fluid, and that it must be fullscreen (no visible "window") I.e. no Titlebar, just a Borderless fullscreen Window.

什么是最好的方式,以确保一切都保持流畅,我的意思是,我们如何才能确保一切似乎它应该,因为你知道,不同的分辨率,显示器尺寸等?

What is the best way to make sure everything stays fluid, I mean how can we make sure everything appears where it should, 'cause you know, different resolutions, monitor sizes etc?

这是很容易在网页/ CSS,但是这不是我所做过的事情。大多数控件编程会在运行时创建的,基于什么样的行动进行,等我将如何完成这样的布局?基本上,我希望能够打好这一切全屏幕,不知道如何大的显示器,或者他们正在使用的解决方案。

This is easy in web pages/css, but this is not something I've done before. Most of the Controls will be created programatically at runtime, based on what action was performed, etc. How would I accomplish such a layout? Basically I want to be able to lay it all out full screen, without knowing how large their monitor is, or what resolution they're using.

推荐答案

您在试图设计采用流体布局响应形式字体的可用空间和尺寸的大小的形式肯定是正确的。要做到这一点,你需要使用下面的控件和控件的属性。

Your certainly correct in trying to design your form using a fluid layout that responds to the size of the available space and size of the form font. To do that you want to use the following controls and control properties.

1,的TableLayoutPanel 会分裂的区域分成一组行和列,让你的那个表格布局单个细胞内定位的子控件。这个响应的形式的宽度和高度的变化。

1, TableLayoutPanel will split an area into a set of rows and columns and allow you to position your child controls within individual cells of that table layout. This responds to a change in the form width and height.

2, FlowLayoutPanel的将定位从左至右,当你用尽空间自动移动到一个新行的子控件。这是伟大的流体设计,因为它会调整布局取决于可用空间。

2, FlowLayoutPanel will position your child controls from left to right and automatically move to a new row when you run out of space. This is great for a fluid design as it will adjust the layout depending on the available space.

3, Control.Anchor 属性允许子控件基于表单的客户端区域的大小来改变位置和大小。所以,你让你的控制始终是从右侧或底部边缘的固定偏移量。

3, Control.Anchor property allows a child control to alter position and size based on the size of the form client area. So you make your control always be a fixed offset from the right or bottom edges.

4, Control.Dock 属性将定位对一个边缘的子控件和相对大小将自动被包含的形式来定义。

4, Control.Dock property will position a child control against an edge and the opposite size will automatically be defined by the containing form.

这篇关于码头,锚和流体布局在Windows窗体应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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