// get current right bottom corner position(X, Y), support 4 mode: taskbar bottom/right/up/left public System.Drawing.Point getCornerLocation(Size windowSize) { int xPos = 0, yPos = 0; if ((Screen.PrimaryScreen.Bounds.Width == Screen.PrimaryScreen.WorkingArea.Width) && (Screen.PrimaryScreen.WorkingArea.Y == 0)) { //taskbar bottom xPos = Screen.PrimaryScreen.WorkingArea.Width - windowSize.Width; yPos = Screen.PrimaryScreen.WorkingArea.Height - windowSize.Height; } else if ((Screen.PrimaryScreen.Bounds.Height == Screen.PrimaryScreen.WorkingArea.Height) && (Screen.PrimaryScreen.WorkingArea.X == 0)) { //taskbar right xPos = Screen.PrimaryScreen.WorkingArea.Width - windowSize.Width; yPos = Screen.PrimaryScreen.WorkingArea.Height - windowSize.Height; } else if ((Screen.PrimaryScreen.Bounds.Width == Screen.PrimaryScreen.WorkingArea.Width) && (Screen.PrimaryScreen.WorkingArea.Y > 0)) { //taskbar up xPos = Screen.PrimaryScreen.WorkingArea.Width - windowSize.Width; yPos = Screen.PrimaryScreen.WorkingArea.Y; } else if ((Screen.PrimaryScreen.Bounds.Height == Screen.PrimaryScreen.WorkingArea.Height) && (Screen.PrimaryScreen.WorkingArea.X > 0)) { //taskbar left xPos = Screen.PrimaryScreen.WorkingArea.X; yPos = Screen.PrimaryScreen.WorkingArea.Height - windowSize.Height; } return new System.Drawing.Point(xPos, yPos); }