public void SetPanel(BaseExamplePanel panel) { if (currentPanel != null && !currentPanel.IsDisposed) { currentPanel.Dispose(); } currentPanel = panel; currentPanel.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; currentPanel.Location = new Point(treeView.Location.X + treeView.Width, uwfHeaderHeight); currentPanel.Height = Height - uwfHeaderHeight; currentPanel.Width = Width - treeView.Width; Controls.Add(currentPanel); currentPanel.Initialize(); }
public void SetPanel(BaseExamplePanel panel) { if (currentPanel != null && currentPanel.IsDisposed == false) { currentPanel.Dispose(); } currentPanel = panel; currentPanel.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; currentPanel.Location = new Point(treeView.Location.X + treeView.Width, uwfHeaderHeight); currentPanel.Height = Height - uwfHeaderHeight - 16; // We don't want to hide SizeGripRenderer with scrollbars. currentPanel.Width = Width - treeView.Width; Controls.Add(currentPanel); currentPanel.Initialize(); }
private void TreeViewOnNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button != MouseButtons.Left || e.Node == null || e.Node.Tag == null) { return; } var panelType = e.Node.Tag as Type; if (panelType == null) { return; } var panel = Activator.CreateInstance(panelType) as BaseExamplePanel; if (panel == null) { return; } if (currentPanel != null && currentPanel.IsDisposed == false) { currentPanel.Dispose(); } currentPanel = panel; currentPanel.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; currentPanel.Location = new Point(treeView.Location.X + treeView.Width, uwfHeaderHeight); currentPanel.Height = Height - uwfHeaderHeight - 16; // We don't want to hide SizeGripRenderer with scrollbars. currentPanel.Width = Width - treeView.Width; Controls.Add(currentPanel); currentPanel.Initialize(); }