void SetDeclarationViewLocation()
{
// This method uses the side with more free space
int leftSpace = Bounds.Left - workingScreen.Left;
int rightSpace = workingScreen.Right - Bounds.Right;
Point pos;
// The declaration view window has better line break when used on
// the right side, so prefer the right side to the left.
if (rightSpace * 2 > leftSpace) {
declarationViewWindow.FixedWidth = false;
pos = new Point(Bounds.Right, Bounds.Top);
if (declarationViewWindow.Location != pos) {
declarationViewWindow.Location = pos;
}
} else {
declarationViewWindow.Width = declarationViewWindow.GetRequiredLeftHandSideWidth(new Point(Bounds.Left, Bounds.Top));
declarationViewWindow.FixedWidth = true;
if (Bounds.Left < declarationViewWindow.Width) {
pos = new Point(0, Bounds.Top);
} else {
pos = new Point(Bounds.Left - declarationViewWindow.Width, Bounds.Top);
}
if (declarationViewWindow.Location != pos) {
declarationViewWindow.Location = pos;
}
declarationViewWindow.Refresh();
}
}