public void drawGeneralElements(AState inputState) { AState tempStateDialogue = inputState; // create labelID Label labelID = new Label(); labelID.Name = "labelID"; labelID.Text = "ID = " + tempStateDialogue.getID().ToString(); labelID.Location = new Point(0 + 20, 45); labelID.AutoSize = true; canvas.Controls.Add(labelID); // create labelOrigin Label labelOrigin = new Label(); labelOrigin.Name = "labelOrigin"; labelOrigin.Text = "Origin: "; labelOrigin.Location = new Point(labelID.Location.X + labelID.Width + 5, labelID.Location.Y); labelOrigin.AutoSize = true; canvas.Controls.Add(labelOrigin); // create originCombobox ComboBox originCombobox = new ComboBox(); originCombobox.Name = "originCombobox"; originCombobox.Location = new Point(labelOrigin.Location.X + labelOrigin.Width + 5, labelOrigin.Location.Y); if (gc.nPCs != null) { foreach (NPC npc in gc.nPCs) { originCombobox.Items.Add(npc.MId.ToString() + " - " + npc.MName); } if (inputState.origin != -1) { string currentValue = inputState.origin.ToString() + " - " + gc.getNPC(inputState.origin).MName; originCombobox.SelectedIndex = originCombobox.FindString(currentValue); } } canvas.Controls.Add(originCombobox); // create listNextState ListView NextStates = new ListView(); NextStates.Name = "NextStates"; NextStates.View = View.Details; NextStates.Width = canvas.Width / 3 - 20; NextStates.Height = 100; NextStates.LabelEdit = true; NextStates.Location = new Point(0 + 20, labelID.Location.Y + labelID.Height + 10); canvas.Controls.Add(NextStates); NextStates.Columns.Add("Next state(s)", NextStates.Width - 4, HorizontalAlignment.Left); NextStates.MouseUp += new MouseEventHandler(NextStates_MouseUp); uint?[] nextStates = tempStateDialogue.getNextStates(); foreach (uint?ns in nextStates) { var listViewItem = new ListViewItem(ns.ToString()); NextStates.Items.Add(listViewItem); } // comboboxes Label Label endThreadLabel = new Label(); Label endGameLabel = new Label(); endThreadLabel.Location = new Point(20, NextStates.Location.Y + NextStates.Height + 5); endGameLabel.Location = new Point(20, endThreadLabel.Location.Y + endThreadLabel.Height + 5); endThreadLabel.Text = "end thread"; endGameLabel.Text = "end game"; endThreadLabel.Width = 70; endGameLabel.Width = 70; canvas.Controls.Add(endThreadLabel); canvas.Controls.Add(endGameLabel); // create comboboxes ComboBox endThread = new ComboBox(); ComboBox endGame = new ComboBox(); endThread.Location = new Point(endThreadLabel.Location.X + endThreadLabel.Width, endThreadLabel.Location.Y); endGame.Location = new Point(endGameLabel.Location.X + endGameLabel.Width, endGameLabel.Location.Y); endThread.Items.Add("true"); endThread.Items.Add("false"); endGame.Items.Add("true"); endGame.Items.Add("false"); endGame.Name = "endGame"; endThread.Name = "endThread"; // fill comboboxes if (tempStateDialogue.isEndGame()) { endGame.SelectedIndex = 0; } else { endGame.SelectedIndex = 1; } if (tempStateDialogue.isEndThread()) { endThread.SelectedIndex = 0; } else { endThread.SelectedIndex = 1; } canvas.Controls.Add(endGame); canvas.Controls.Add(endThread); // create labelParentThread Label labelParentThread = new Label(); labelParentThread.Name = "labelParentThread"; labelParentThread.Text = "Parent thread: "; labelParentThread.Location = new Point(endGameLabel.Location.X, endGameLabel.Location.Y + endGameLabel.Height + 5); labelParentThread.AutoSize = true; canvas.Controls.Add(labelParentThread); // create parentThreadCombobox ComboBox parentThreadCombobox = new ComboBox(); parentThreadCombobox.Name = "parentThreadCombobox"; parentThreadCombobox.Location = new Point(labelParentThread.Location.X + labelParentThread.Width + 5, labelParentThread.Location.Y); if (gc.Threads != null) { foreach (thread th in gc.Threads) { parentThreadCombobox.Items.Add(th.MID.ToString() + " - " + th.MDescription); } //if (inputState.MParentThread != -1) //{ string currentValue = inputState.MParentThread.ToString() + " - " + gc.getThread(inputState.MParentThread).MDescription; parentThreadCombobox.SelectedIndex = parentThreadCombobox.FindString(currentValue); //} } canvas.Controls.Add(parentThreadCombobox); // create hidden labelParentThread Label labelHiddenParentThread = new Label(); labelHiddenParentThread.Name = "labelHiddenParentThread"; labelHiddenParentThread.Text = inputState.MParentThread.ToString(); labelHiddenParentThread.Location = new Point(endGameLabel.Location.X, endGameLabel.Location.Y + endGameLabel.Height + 5); labelHiddenParentThread.Visible = false; canvas.Controls.Add(labelHiddenParentThread); // create saveButton Button saveButton = new Button(); saveButton.Name = "saveButton"; saveButton.Width = canvas.Width / 3 - 20; saveButton.Location = new Point(0 + 20, 20); saveButton.Text = "Save State"; saveButton.Click += new System.EventHandler(saveButtonClick); canvas.Controls.Add(saveButton); }