コード例 #1
0
        public void ListDraw()
        {
            try
            {
                tt.RemoveAll();
                panList.Controls.Clear();
                panList.Location = new Point(0, 0);
                panList.Size     = new Size(530, 0);
                np = 1;

                int y = 0;

                foreach (var it in args)
                {
                    CarList01 rl = new CarList01(it, this);
                    rl.Location = new Point(0, y);
                    panList.Controls.Add(rl);
                    y           += rl.Height;
                    panList.Size = new Size(530, y);
                    string type = "";
                    if (it is Locomotive)
                    {
                        type = TextManager.Get().Text("locomotive");
                    }
                    else if (it is Coach)
                    {
                        type = TextManager.Get().Text("coach");
                    }
                    else if (it is EngineCoach)
                    {
                        type = TextManager.Get().Text("enginecoach");
                    }
                    tt.SetToolTip(rl, it.Name + "(" + type + ")");
                }

                mp = RTCore.Environment.CalcPage(args.Count, 10);

                SetPage();
            }
            catch (Exception ex)
            {
                RTCore.Environment.ReportError(ex, AccessManager.AccessKey);
            }
        }
コード例 #2
0
        public CarList01 GetCarList(CarList01 cl, GetType t)
        {
            if (t == GetType.Up)
            {
                List <CarList01> tmp = new List <CarList01>();
                foreach (var it in panList.Controls)
                {
                    tmp.Add((CarList01)it);
                }

                if (cl.Location.Y == 0)
                {
                    return(null);
                }

                Control ctrl = tmp.First(x => x.Location == new Point(0, cl.Location.Y - 40));

                return((CarList01)ctrl);
            }
            else
            {
                List <CarList01> tmp = new List <CarList01>();
                foreach (var it in panList.Controls)
                {
                    tmp.Add((CarList01)it);
                }

                if (cl.Location.Y == panList.Height - 40)
                {
                    return(null);
                }

                Control ctrl = tmp.First(x => x.Location == new Point(0, cl.Location.Y + 40));

                return((CarList01)ctrl);
            }
        }
コード例 #3
0
        public void ChangeOrder(CarList01 cl1, CarList01 cl2)
        {
            if (cl1 == null || cl2 == null)
            {
                return;
            }

            Point p1 = cl1.Location;
            Point p2 = cl2.Location;

            cl2.Location = p1;
            cl1.Location = p2;

            cl2.BackColor = Color.Transparent;
            cl1.BackColor = Color.Transparent;
            cl2.isSelect  = false;
            cl1.isSelect  = false;

            int cl1_inx = args.IndexOf(cl1.tp);
            int cl2_inx = args.IndexOf(cl2.tp);

            args[cl1_inx] = cl2.tp;
            args[cl2_inx] = cl1.tp;
        }