Exemple #1
0
        private void _layoutPiece_ForceRedraw(object sender, MyPictureBoxEventArgs e)
        {
            //get layout stats
            TileContainerStats attribs = e.Attributes;

            //remove current control from layout panel
            attribs.LayoutPanel.Controls.Remove((Control)sender);
            //make a new panel (automatically adds to appropriate panel)
            MakePane(attribs.I, attribs.J, attribs.X, attribs.Y, attribs.Container, attribs.LayoutPanel);
            //cast sender as a control
            Control c = (Control)sender;

            //dispose of sender
            c.Dispose();
        }
Exemple #2
0
        }     //end ParseLineData

        public MyPictureBox MakePane(int i, int j, int x, int y, LayoutCellDataContainer c, Panel drawingPanel)
        {
            /*
             * if (this.InvokeRequired)
             * {
             *  //this.Invoke(new Action(this.MakePane(i,j,x,y,c,drawingPanel)));
             *  //return;
             * }
             */

            MyPictureBox pane = new MyPictureBox(drawingPanel, this);

            pane.Name     = "_imgGridGreen_" + i + "_" + j;
            pane.SizeMode = PictureBoxSizeMode.CenterImage;
            pane.Size     = new Size(20, 20);
            pane.Location = new Point(x, y);
            pane.Tag      = c;
            pane.Image    = c.Tile;
            c.Panel       = pane;
            TileContainerStats attribs = new TileContainerStats(i, j, x, y, c, drawingPanel);

            pane.Attributes  = attribs;
            pane.MouseClick += _layoutPiece_MouseClick;

            if (c.Train != null)
            {
                pane.MouseHover += new EventHandler(pane_MouseHover);
                pane.MouseLeave += new EventHandler(pane_MouseLeave);
            }
            else if (c.Block != null)
            {
                if (c.Block.hasStation())
                {
                    pane.MouseHover += new EventHandler(pane_MouseHover);
                    pane.MouseLeave += new EventHandler(pane_MouseLeave);
                }
            }

            pane.ForceRedraw += _layoutPiece_ForceRedraw;
            drawingPanel.Controls.Add(pane);
            return(pane);
        }
        public MyPictureBox MakePane(int i, int j, int x, int y, LayoutCellDataContainer c, Panel drawingPanel)
        {
            /*
            if (this.InvokeRequired)
            {
                //this.Invoke(new Action(this.MakePane(i,j,x,y,c,drawingPanel)));
                //return;
            }
             */

            MyPictureBox pane = new MyPictureBox(drawingPanel, this);
            pane.Name = "_imgGridGreen_" + i + "_" + j;
            pane.SizeMode = PictureBoxSizeMode.CenterImage;
            pane.Size = new Size(20, 20);
            pane.Location = new Point(x, y);
            pane.Tag = c;
            pane.Image = c.Tile;
            c.Panel = pane;
            TileContainerStats attribs = new TileContainerStats(i, j, x, y, c, drawingPanel);
            pane.Attributes = attribs;
            pane.MouseClick += _layoutPiece_MouseClick;

            if (c.Train != null)
            {
                pane.MouseHover += new EventHandler(pane_MouseHover);
                pane.MouseLeave += new EventHandler(pane_MouseLeave);
            }
            else if (c.Block != null)
            {
                if (c.Block.hasStation())
                {
                    pane.MouseHover += new EventHandler(pane_MouseHover);
                    pane.MouseLeave += new EventHandler(pane_MouseLeave);
                }
            }

            pane.ForceRedraw += _layoutPiece_ForceRedraw;
            drawingPanel.Controls.Add(pane);
            return pane;
        }
 public MyPictureBox(Panel linePanel, UserControl ctcOfficeGuiControl)
 {
     _master    = linePanel;
     _container = ctcOfficeGuiControl;
     _attribs   = null;
 }
 public MyPictureBoxEventArgs(TileContainerStats stats)
 {
     _stats = stats;
 }
 public MyPictureBox(Panel linePanel, UserControl ctcOfficeGuiControl)
 {
     _master = linePanel;
     _container = ctcOfficeGuiControl;
     _attribs = null;
 }
 public MyPictureBoxEventArgs(TileContainerStats stats)
 {
     _stats = stats;
 }