internal StationList01 GetStationList(StationList01 sl, GetType t) { if (t == GetType.Up) { List <StationList01> tmp = new List <StationList01>(); foreach (var it in panList.Controls) { tmp.Add((StationList01)it); } if (sl.Location.Y == 0) { return(null); } Control ctrl = tmp.First(x => x.Location == new Point(0, sl.Location.Y - 40)); return((StationList01)ctrl); } else { List <StationList01> tmp = new List <StationList01>(); foreach (var it in panList.Controls) { tmp.Add((StationList01)it); } if (sl.Location.Y == panList.Height - 40) { return(null); } Control ctrl = tmp.First(x => x.Location == new Point(0, sl.Location.Y + 40)); return((StationList01)ctrl); } }
internal void ListDraw() { try { tt.RemoveAll(); panList.Controls.Clear(); panList.Size = new Size(730, 0); panList.Location = new Point(0, 0); int y = 0; foreach (var it in stas) { StationList01 sl = new StationList01(it, this, imgUp, imgUpSel, imgDown, imgDownSel); sl.Location = new Point(0, y); panList.Controls.Add(sl); y += sl.Height; panList.Size = new Size(730, y); tt.SetToolTip(sl, $"{it.Name} ({it.Parent.Parent.Name} {it.Parent.Name})"); } if (panList.Controls.Count <= 9) { panListBack.AutoScroll = false; panListBack.Size = new Size(730, panListBack.Height); } else { panListBack.AutoScroll = true; panListBack.Size = new Size(750, panListBack.Height); } } catch (Exception ex) { RTCore.Environment.ReportError(ex, AccessManager.AccessKey); } }
internal void ChangeOrder(StationList01 sl1, StationList01 sl2) { if (sl1 == null || sl2 == null) { return; } Point p1 = sl1.Location; Point p2 = sl2.Location; sl2.Location = p1; sl1.Location = p2; sl2.BackColor = Color.Transparent; sl1.BackColor = Color.Transparent; sl2.isSelect = false; sl1.isSelect = false; int sl1_inx = stas.IndexOf(sl1.sta); int sl2_inx = stas.IndexOf(sl2.sta); stas[sl1_inx] = sl2.sta; stas[sl2_inx] = sl1.sta; }