internal void AdjustSizeAndLocationForControls(bool fAdjustOverallSize)
{
if (m_fAdjustingSize)
return;
m_fAdjustingSize = true;
try
{
if (m_sandbox != null && m_sandbox.RightToLeftWritingSystem && m_sandbox is UserControl)
{
UserControl sandbox = m_sandbox as UserControl;
if (panelSandbox.Width != sandbox.Width)
panelSandbox.Width = sandbox.Width;
if (sandbox.Location.X != panelSandbox.Width - sandbox.Width)
sandbox.Location = new Point(panelSandbox.Width - sandbox.Width, sandbox.Location.Y);
}
if (m_sandbox != null && fAdjustOverallSize)
{
panelControlBar.Width = panelSandbox.Width; // if greater than min width.
// move control panel to bottom of sandbox panel.
panelControlBar.Location = new Point(panelControlBar.Location.X, panelSandbox.Height - 1);
// move side bar to right of sandbox panel.
if (m_sandbox.RightToLeftWritingSystem)
{
panelSidebar.Location = new Point(0, panelSidebar.Location.Y);
panelControlBar.Location = new Point(panelSidebar.Width, panelControlBar.Location.Y);
panelSandbox.Location = new Point(panelSidebar.Width, panelSandbox.Location.Y);
}
else
{
panelSidebar.Location = new Point(panelSandbox.Width, panelSidebar.Location.Y);
}
this.Size = new Size(panelSidebar.Width + Math.Max(panelSandbox.Width, panelControlBar.Width),
panelControlBar.Height + panelSandbox.Height);
}
}
finally
{
m_fAdjustingSize = false;
}
}