Exemplo n.º 1
0
        }//mouse click

        private void pane_MouseHover(object sender, EventArgs e)
        {
            MyPictureBox b = (MyPictureBox)sender;

            _tt = new ToolTip();
            _tt.AutoPopDelay = 10000;
            _tt.InitialDelay = 200;
            _tt.ReshowDelay  = 500;
            _tt.ShowAlways   = true;
            LayoutCellDataContainer c = (LayoutCellDataContainer)b.Tag;
            string hoverText          = "";

            if (c.Train != null)
            {
                hoverText = c.Train.ToString();
            }
            else if (c.Block.AttrArray.Length > 1)
            {
                hoverText = c.Block.AttrArray[1];
            }
            else
            {
                hoverText = "Error Getting Station Name";
            }
            _tt.Show(hoverText, b);
        }
Exemplo n.º 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;
        }