FlowLayoutPanel儿童控制安排? [英] FlowLayoutPanel Child Control Arrangement?

查看:55
本文介绍了FlowLayoutPanel儿童控制安排?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FlowLayoutPanel控件,它可以很好地满足我的需求,但我需要更改它如何布局子控件(在我的情况下是按钮)。



现在,面板上的每个按钮之间都有空格,我想让它们彼此相邻放置(按钮之间没有空格,无论是左右还是上下)。基本上我有多达90个这样的按钮排列在左右和上下的不同顺序,我想基本上坐在网格上。



我不是能够通过我的谷歌搜索找出如何做到这一点。



有人能告诉我怎么样吗?



谢谢!

I am trying to use a FlowLayoutPanel control, and it works pretty well for what I want, but I need to change how it lays out the child controls (buttons in my case).

Right now, there are spaces between each button on the panel, and I want it to lay them out right next to each other (no space between buttons, either left-right or top-bottom). Basically I have up to 90 of these buttons arranged in different orders of left-right and top-bottom that I want basically sitting like a grid.

I wasn't able to figure out how to do this using my Google searches.

Can someone show me how?

Thanks!

推荐答案

要获得矩形网格的外观,按钮的大小必须相同。然后通过将每个按钮的边距设置为零来消除按钮间间距。这样的事情:

To get the appearance of a rectangular grid, the buttons will all have to be the same size. Then eliminate the inter-button spacing by setting each button's Margin to zero. Something like this:
Button btn = new Button();
btn.Size = new Size(200, 30);
btn.Margin = Padding.Empty;





Alan。



Alan.


这篇关于FlowLayoutPanel儿童控制安排?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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