Child form follow main form

前端 未结 2 1771
孤城傲影
孤城傲影 2020-12-21 05:44

How to make the child form follow main form.

for example: open a winform [.net2], winform opens form, form follows the mainform if mainform is moving.

2条回答
  •  误落风尘
    2020-12-21 06:28

    Superficially simple answer is just to add handlers for when Mainform is moved or resized and then set childform Location and size accordingly.

    However do you say want to stop main form being moved such that childform end up off screen. Can child form be moved independantly. What about minimise and maximise?

    Might you want other arrangements, nore than one child, left and right, child form above main form...

    Be worth writing a layout class, and shoving all this stuff off to it.

提交回复
热议问题