protected void CenterToScreen() {
Size DisplaySize;
int w;
int h;
// MS creates the handle here.
if (TopLevel) {
if (!IsHandleCreated)
CreateHandle ();
}
if (Width > 0) {
w = Width;
} else {
w = DefaultSize.Width;
}
if (Height > 0) {
h = Height;
} else {
h = DefaultSize.Height;
}
XplatUI.GetDisplaySize(out DisplaySize);
this.Location = new Point(DisplaySize.Width / 2 - w / 2, DisplaySize.Height / 2 - h / 2);
}