Ejemplo n.º 1
0
        private void AddDisplayPanel(IGetData dataObject, bool canSwap, Point point)
        {
            DisplayPanel d = new DisplayPanel(dataObject, exitImage, canSwap, point, myPanel.Width, myPanel.Height);

            displayPanels.Add(d);
            myPanel.Controls.Add(d.Panel);
            d.Close           += RemoveDisplayPanel;
            d.Swap            += DisplayPanelSwap;
            d.Panel.MouseMove += DisplayPanel_MouseMove;
            d.MouseDown       += DisplayPanel_MouseDown;

            // Deactivate the old panel, reassign the active panel, then activate the new panel.
            if (activeDisplayPanel != null)
            {
                activeDisplayPanel.Deactivate();
            }
            activeDisplayPanel = d;
            activeDisplayPanel.Activate();
        }
Ejemplo n.º 2
0
        // The exit button on one of the display panels has been clicked. Remove the display panel from the list.
        private void RemoveDisplayPanel(object sender, EventArgs e)
        {
            DisplayPanel d = (DisplayPanel)sender;

            d.Close           -= RemoveDisplayPanel;
            d.Swap            -= DisplayPanelSwap;
            d.Panel.MouseMove += DisplayPanel_MouseMove;
            d.MouseDown       += DisplayPanel_MouseDown;
            myPanel.Controls.Remove(d.Panel);
            displayPanels.Remove(d); // Delete the reference to the DisplayPanel so the garbage collector can remove it.

            if (displayPanels.Count >= 1)
            {
                activeDisplayPanel = displayPanels[0];
                activeDisplayPanel.Activate();
            }
            else
            {
                activeDisplayPanel = null;
            }

            Focus();
        }
Ejemplo n.º 3
0
 private void SwapToDisplayPanel(int i)
 {
     activeDisplayPanel.Deactivate();
     activeDisplayPanel = displayPanels[i];
     activeDisplayPanel.Activate();
 }