Originally Posted by
switchblade327
Have you tried with Screen.PrimaryScreen.WorkingArea ? If not try this code:
Code:
this.Location = new Point (Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
The code works poorly, if start is not located in the bottom ...
Below code takes into account the start: (it is in VB.NET, convert it to C# even)
Code:
Public Shared Sub SetLoc(ByVal FName As System.Windows.Forms.Form, ByVal Padding As Integer, ByVal ScrLoc As Publics.Lcs)
Dim XLoc As Integer
Dim YLoc As Integer
YLoc = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - FName.Size.Height
XLoc = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - FName.Size.Width
If ScrLoc = Publics.Lcs.Upper_Left Then
FName.Location = New System.Drawing.Point (Padding + Screen.PrimaryScreen.WorkingArea.X, Padding + Screen.PrimaryScreen.WorkingArea.Y)
Elseif ScrLoc = Publics.Lcs.Upper_Right Then
FName.Location = New System.Drawing.Point (XLoc - Padding + Screen.PrimaryScreen.WorkingArea.X, Padding + Screen.PrimaryScreen.WorkingArea.Y)
Elseif ScrLoc = Publics.Lcs.Bottom_Left Then
FName.Location = New System.Drawing.Point (Padding + Screen.PrimaryScreen.WorkingArea.X, YLoc - Padding + Screen.PrimaryScreen.WorkingArea.Y)
Elseif ScrLoc = Publics.Lcs.Bottom_Right Then
FName.Location = New System.Drawing.Point (XLoc - Padding + Screen.PrimaryScreen.WorkingArea.X, YLoc - Padding + Screen.PrimaryScreen.WorkingArea.Y)
End If
End Sub
Public Enum LCS As Integer
Upper_Left = 1
Upper_Right = 2
Bottom_Left = 3
Bottom_Right = 4
End Enum
Bookmarks