Hide the border between two combined cells in TableLayoutPanel [duplicate]

与世无争的帅哥 提交于 2021-02-08 08:58:45

问题


I have 4x4 table. How to make that the first row will have 2 cells only? Tried with ColumnSpan but it's still drawing borders between cells.

Example:

----------------------
|   A     |      B   |
----------------------
| 1  |  2 |  3  |   4|
----------------------

回答1:


You can Dock a Panel with Margin=0 in a cell and then span that Panel to the desired size and use it as the container of the objects in the cell.

Alternatively, you can set AutoSize of a Label to false and then set its Dock to Fill and then span that Label to the desired size.

(The Panel is shown in Green, the Labels are shown in Yellow)

The only problem when using borders with 2 pixels width (like inset) is it makes one pixel to appear at the top. This can be avoided using 1-pixel wide border type (like Single)



来源:https://stackoverflow.com/questions/53923078/hide-the-border-between-two-combined-cells-in-tablelayoutpanel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!