SizeToContent equivalent for a WinForm?

后端 未结 1 515
走了就别回头了
走了就别回头了 2020-12-22 03:02

When playing with WPF, I discovered the SizeToContent method, which enables me to create dynamically the content of a window, and then have it automatically resized to fit i

1条回答
  •  时光说笑
    2020-12-22 03:54

    As far as I remember this is a bit tricky in Windows Forms. Basically you need to use auto-sizing containers (e.g. TableLayoutPanel, etc. – and set their AutoSize property to true) in the form exclusively. Laying out controls with Anchor and Dock does not work.

    0 讨论(0)
提交回复
热议问题