Don't ask why but I have the requirement to draw a border around certain cells in a TableLayoutPanel
.
For example, for simplicity, lets say I have a 1 row, 5 column TableLayoutPanel
. Each cell has a button in it. I would like to draw a box around the first 3 cells and then another box around the last 2 cells. So two boxes total.
Any suggestions on how to accomplish that?
Thanks.
Access properties for the tableLayoutPanel and Set the CellBorderStyle to Single
You could use
CellPaint
event and draw the border rectangle when needed:The handler:
You can draw any kind of border using
ControlPaint
: