I have a Windows Forms application in which I use the following code to attach it to the lower right of the screen at startup:
protected override void OnLoad(EventArgs e)
{
var s = Screen.FromPoint(this.Location);
this.Location = new Point(s.WorkingArea.Right - this.Width,
s.WorkingArea.Height - this.Height);
base.OnLoad(e);
}
When I work in Visual Studio debugging mode, it works like a charm. When I create the installer and install the application (in the same dev block) and run it, the coordinates are slightly different, and the form is not perfectly fixed in the corner. So I am stuck in OnLoad:
MessageBox.Show(this.Location.X + "x" + this.Location.Y);
In development mode, it displays 1355x720 , but when installed, it displays 1365x730
Why the discrepancy? Obviously, I could just subtract 10 for my code to work, but I would like to explain this behavior.
Update:
- 64- Windows 8.1 Pro .
- , (
Screen.WorkingArea). 245x140, , 235x130 - . , onload, . , , . , ; VS. , , .
TopMost True