public void ComputeForWindowLength_Test() { SystemRect rect = new SystemRect { Left = 0, Top = 0, Right = 800, Bottom = 400, }; int length = _screenCalculator.ComputeForWindowLength(rect.Right, rect.Left); Assert.AreEqual(length, 800); }
public void ComputeForY_Test() { SystemRect rect = new SystemRect { Left = 0, Top = 0, Right = 800, Bottom = 400, }; int y = _screenCalculator.ComputeForY(1040, rect, 0); Assert.AreEqual(y, 320); }
public void ComputeForX_Test() { SystemRect rect = new SystemRect { Left = 0, Top = 0, Right = 800, Bottom = 400, }; int x = _screenCalculator.ComputeForX(1920, rect, 0); Assert.AreEqual(x, 560); }
public int ComputeForX(int screenWidth, SystemRect systemRect, int xPos) { return(xPos + ((screenWidth - ComputeForWindowLength(systemRect.Right, systemRect.Left)) / 2)); }
public int ComputeForY(int screenHeight, SystemRect systemRect, int yPos) { return(yPos + ((screenHeight - ComputeForWindowLength(systemRect.Bottom, systemRect.Top)) / 2)); }
static extern bool GetWindowRect(IntPtr handle, out SystemRect rectangle);