In the following code, I'm trying to define a custom type:
public class WindowPosition
{
public static WindowPosition Below;
public static WindowPosition Right;
}
private void ChildWindow(Form Form, WindowPosition Position)
{
Form.Location = new Point(
Position == WindowPosition.Right ? this.Location.X + this.Width : 0,
Position == WindowPosition.Below ? this.Location.Y + this.Height : 0
);
Form.Show();
}
private void buttonNew_Click(object sender, EventArgs e)
{
ChildWindow(new New(), WindowPosition.Below);
}
The code is supposed to make the New
form open directly below the main form - but instead it's opening here:
New
's StartPosition
is set to Manual
.
I think I'm defining the type improperly. How can I properly define it?
Or otherwise what is the problem, or am I approaching this the wrong way?