コード例 #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();
        }
コード例 #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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 public MyPictureBox(Panel linePanel, UserControl ctcOfficeGuiControl)
 {
     _master    = linePanel;
     _container = ctcOfficeGuiControl;
     _attribs   = null;
 }
コード例 #5
0
 public MyPictureBoxEventArgs(TileContainerStats stats)
 {
     _stats = stats;
 }
コード例 #6
0
 public MyPictureBox(Panel linePanel, UserControl ctcOfficeGuiControl)
 {
     _master = linePanel;
     _container = ctcOfficeGuiControl;
     _attribs = null;
 }
コード例 #7
0
 public MyPictureBoxEventArgs(TileContainerStats stats)
 {
     _stats = stats;
 }