private void HideLevelViewer() { if (m_vc != null) { Controls.Remove(m_vc); m_vc.Dispose(); m_vc = null; } }
private void ShowCgfViewer(CgfLoader cgf) { HideLevelViewer(); HideImageViewer(); HideTextViewer(); m_vc = new AionLevelViewerControl(null, null, cgf); m_vc.Location = new Point(m_treeView.Width, m_menuStrip.Bottom); var clientHeight = ClientSize.Height - m_menuStrip.Height; m_vc.Size = new Size(ClientSize.Width - m_treeView.Width, clientHeight); m_vc.OnUpdateTitle += OnLevelViewerControlTitleUpdated; Controls.Add(m_vc); m_vc.Focus(); Invalidate(); }
private void ChangeLevel(string levelFolder) { SetTitleBase(Path.Combine(m_clientRoot, "Levels", levelFolder)); HideLevelViewer(); HideImageViewer(); HideTextViewer(); m_vc = new AionLevelViewerControl(m_clientRoot, levelFolder, null); m_vc.Location = new Point(m_treeView.Width, m_menuStrip.Bottom); var clientHeight = ClientSize.Height - m_menuStrip.Height; m_vc.Size = new Size(ClientSize.Width - m_treeView.Width, clientHeight); m_vc.OnUpdateTitle += OnLevelViewerControlTitleUpdated; Controls.Add(m_vc); m_vc.Focus(); Invalidate(); m_vc.m_game.SetProjection(ClientSize.Width - m_treeView.Width, clientHeight); }
private void FakeResizeLevelViewer(int newWidth, int newHeight) { if (m_vc == null) { return; } // monogame/forms distorts the aspect after a resize... // this works around the issue by reattaching the game to a fresh control. Controls.Remove(m_vc); var old = m_vc; old.m_game.SetProjection(newWidth, newHeight); m_vc = new AionLevelViewerControl(old.m_game); m_vc.Location = new Point(m_treeView.Right, m_menuStrip.Bottom); m_vc.Size = new Size(newWidth, newHeight); m_vc.OnUpdateTitle += OnLevelViewerControlTitleUpdated; Controls.Add(m_vc); old.Dispose(); }