vb.netvisual-studio-designer

How to maintain control in center with anchor(left,right)/dock(fill) and maximum width


Let's say we have form with docked GroupBox. GroupBox have docked TableLayoutPanel with 2 rows (50% height each). Each row have Button. I want this buttons to be centered in TableLayoutPanel cells, expanding with form but also have a maximum width.

Example form:

ex_form_img

If I use anchor(left,right) or dock(fill) and then set maximum width for buttons, they stay on left side of cells. Is there a way to do what I want (have button in center when reached max width) using only designer?


Solution

  • But you cannot achieve limiting the button size together with centering. You can do it only dynamically, through code.