Place WinForm On Bottom-Right

前端 未结 5 1682
盖世英雄少女心
盖世英雄少女心 2020-12-10 23:47

How can I place a form at the bottom-right of the screen when it loads using C#?

相关标签:
5条回答
  • 2020-12-11 00:16

    This worked for me; i just put this code listed below after my InitializeComponent();

    public FormProgress()
    {
        this.StartPosition = FormStartPosition.Manual;
        this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
    }
    
    0 讨论(0)
  • 2020-12-11 00:23

    try something on the lines of

    Rectangle workingArea = Screen.GetWorkingArea(this);
    this.Location = new Point(workingArea.Right - Size.Width, 
                              workingArea.Bottom - Size.Height);
    

    Hope it works well for you.

    0 讨论(0)
  • 2020-12-11 00:36
    Form2 a = new Form2();
    a.StartPosition = FormStartPosition.Manual;
    a.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - a.Width, 
                           Screen.PrimaryScreen.WorkingArea.Height - a.Height);
    
    0 讨论(0)
  • 2020-12-11 00:39

    It's easy to try;

    //Get screen resolution
    Rectangle res = Screen.PrimaryScreen.Bounds; 
    
    // Calculate location (etc. 1366 Width - form size...)
    this.Location = new Point(res.Width - Size.Width, res.Height - Size.Height); 
    
    0 讨论(0)
  • 2020-12-11 00:39

    In you form constructor put the following code:

    StartPosition = FormStartPosition.Manual;
    

    This will set the start position of the form to whatever you set as the value for the form's location (you can set this in the form designer).

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