protected override void LoadDockingElement(XmlReader xmlReader, KryptonPageCollection pages)
{
// Grab the requested size and location
Point location = CommonHelper.StringToPoint(xmlReader.GetAttribute("L"));
Size clientSize = CommonHelper.StringToSize(xmlReader.GetAttribute("S"));
// Find the size of the floating window borders
int hBorders = FloatingWindow.Width - FloatingWindow.ClientSize.Width;
int vBorders = FloatingWindow.Height - FloatingWindow.ClientSize.Height;
// Find the monitor that has the window
Rectangle workingArea = Screen.GetWorkingArea(new Rectangle(location, clientSize));
// Limit client size to that which will fit inside the working area
if (clientSize.Width > (workingArea.Width - hBorders))
clientSize.Width = workingArea.Width - hBorders;
if (clientSize.Height > (workingArea.Height - vBorders))
clientSize.Height = workingArea.Height - vBorders;
// Ensure floating window is positioned inside the working area
if (location.X < workingArea.X)
location.X = workingArea.X;
else if ((location.X + clientSize.Width + hBorders) > workingArea.Right)
location.X = workingArea.Right - clientSize.Width - hBorders;
if (location.Y < workingArea.Y)
location.Y = workingArea.Y;
else if ((location.Y + clientSize.Height + vBorders) > workingArea.Bottom)
location.Y = workingArea.Bottom - clientSize.Height - vBorders;
// Update floating window with loaded size/position
FloatingWindow.Location = location;
FloatingWindow.ClientSize = clientSize;
}