【问题标题】:Place WinForm On Bottom-Right将 WinForm 放在右下角
【发布时间】:2010-11-26 00:29:05
【问题描述】:

如何在使用 C# 加载时将表单放置在屏幕的右下角?

【问题讨论】:

标签: c# .net winforms


【解决方案1】:

这对我有用;我只是把下面列出的这段代码放在我的InitializeComponent();

之后
public FormProgress()
{
    this.StartPosition = FormStartPosition.Manual;
    this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
}

【讨论】:

    【解决方案2】:

    很容易尝试;

    //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); 
    

    【讨论】:

      【解决方案3】:
      Form2 a = new Form2();
      a.StartPosition = FormStartPosition.Manual;
      a.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - a.Width, 
                             Screen.PrimaryScreen.WorkingArea.Height - a.Height);
      

      【讨论】:

        【解决方案4】:

        尝试一下

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

        希望它对你有用。

        【讨论】:

        • 优秀。谢谢你,我希望我能接受这个作为答案:p
        • 不同显示器,不同位置运行
        【解决方案5】:

        在你的表单构造函数中输入以下代码:

        StartPosition = FormStartPosition.Manual;
        

        这会将表单的起始位置设置为您设置为表单位置值的任何值(您可以在表单设计器中设置)。

        【讨论】:

        • 这个问题是每个人都使用不同尺寸的屏幕,它在你的屏幕上可能看起来不错,但并不是说它会在客户身上......
        • +1 - 是的,我想你也需要那个,让表单使用你指定的位置。
        猜你喜欢
        • 2017-10-23
        • 1970-01-01
        • 2012-09-02
        • 1970-01-01
        • 2013-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多