How to make form always on top in Application

前端 未结 2 2202
一个人的身影
一个人的身影 2021-02-13 20:46

I have a form that i want to always be on top whenever it is opened in the application but i dont want it to be on top when the main form is minimized or another application is

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-13 21:07

    Set the top level and then set the owner, example below.

    public Form1()
    {
        InitializeComponent();
        Form2 f2 = new Form2();
        //top level not really needed
        f2.TopLevel = true;
        f2.Show(this);
    }
    

提交回复
热议问题