Show a winform over the notification area

后端 未结 3 418
半阙折子戏
半阙折子戏 2020-12-19 09:40

I want to show a winform in the very right down corner just above the system tray,

How do I do that? Here is my code:

public static void Noti         


        
3条回答
  •  萌比男神i
    2020-12-19 10:13

    If you wanted to position the form over/infront of the taskbar:

    Set the forms TopMost property to true. You can use Screen.PrimaryScreen.Bounds to get the screen resolution then set your forms position appropriately.


    If you just want to position the form just above the taskbar in the bottom right then you can do as follows:

    In the form designer, goto Properties->Events and add the Load event to your form.

    Add the following:

    private void Form1_Load(object sender, EventArgs e)
    {
        this.StartPosition = FormStartPosition.Manual;
        int x = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
        int y = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
        this.Bounds = new Rectangle(x, y, this.Width, this.Height);
    }
    

提交回复
热议问题