private void ResizePaneToMatchWindowAndRoomSize()
{
if (_room == null)
{
return;
}
if (this.Width >= 200)
{
int requiredRoomWidth = _room.Width * _state.ScaleFactor + SCROLLBAR_WIDTH_BUFFER + bufferedPanel1.Left;
mainFrame.Width = this.Width - 10;
mainFrame.Width = Math.Min(mainFrame.Width, requiredRoomWidth);
mainFrame.Width = Math.Max(mainFrame.Width, lblTransparency.Right + 10);
}
if (this.Height >= 200)
{
int requiredRoomHeight = _room.Height * _state.ScaleFactor + SCROLLBAR_WIDTH_BUFFER + bufferedPanel1.Top;
mainFrame.Height = this.Height - 10;
mainFrame.Height = Math.Min(mainFrame.Height, requiredRoomHeight);
}
bufferedPanel1.Size = new Size(mainFrame.DisplayRectangle.Width - bufferedPanel1.Left,
mainFrame.DisplayRectangle.Height - bufferedPanel1.Top);
}