Table layout panel scroll bar

前端 未结 3 446
予麋鹿
予麋鹿 2021-01-01 11:18

given a table layout panel with 2 columns and many rows, how can i attatch a scroll bar to it as sometimes it grows much greater than the size of the form .

Thank yo

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-01 11:51

    The TableLayoutPanel is an example of a ScrollableControl. You can therefore set it's AutoScroll property to True and the control will automatically create scroll bars when it's preferred size exceeds its current size. This will provide you with the desired effect with minimal hassle.

    Procedure

    1. Set the MaximumSize property to a preferred maximum size or you can dock the TableLayoutPanel in your form.
    2. Set the AutoScroll property of the TableLayoutPanel to true.



    FYI:
    The Panel, ToolStrip, FlowLayoutPanel, SplitterPanel, TableLayoutPanel, TabPage and ToolStripContentPanel all inherit the ScrollableControl class so this answer applies to them as well.

提交回复
热议问题