12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace AGV_WPF
- {
- public partial class RemoveError : Form
- {
- public List<Button> listCreateBtns = new List<Button>();
- public RemoveError()
- {
- InitializeComponent();
- }
- private void RemoveError_Load(object sender, EventArgs e)
- {
- }
- public void InitView(Dictionary<int, int> AGVIDWithPosByCheckPos, Dictionary<int, int> AGVIDWithRouteByCheckPos, Dictionary<int, string> checkPosDic)
- {
- for (int i = groupBox1.Controls.Count-1; i >=0; i--)
- {
- if (groupBox1.Controls[i].Name != label1.Name && groupBox1.Controls[i].Name != button1.Name)
- {
- groupBox1.Controls.RemoveAt(i);
- }
- }
- listCreateBtns.Clear();
- if (AGVIDWithPosByCheckPos.Count > 0)
- {
- List<int> listAGV = AGVIDWithPosByCheckPos.Keys.ToList();
- int index = 0;
- foreach (int agvNum in listAGV)
- {
- if (AGVIDWithPosByCheckPos.ContainsKey(agvNum)&&AGVIDWithRouteByCheckPos.ContainsKey(agvNum))
- {
- Label label = new Label();
- string str = "AGV编号:" + agvNum + ",目的地标:" + AGVIDWithPosByCheckPos[agvNum] + ",目的路线:"+ AGVIDWithRouteByCheckPos[agvNum];
- label.Text = str;
- label.Font = label2.Font;
- label.AutoSize=true;
- label.Location = new Point(label2.Location.X,label2.Location.Y+index*(label.Height+30));
- groupBox1.Controls.Add(label);
- Button btn = new Button();
- btn.Text = "解除";
- btn.Font = btn.Font;
- btn.Tag = agvNum;
- btn.Location = new Point(label.Location.X + label.Width + 30, label.Location.Y - 5);
- groupBox1.Controls.Add(btn);
- listCreateBtns.Add(btn);
- ++index;
- }
- }
- }
- }
- }
- }
|