private void EnhancementTreeControl_SlotMouseClick(object sender, TreeControl.TreeEventArgs e) { if (AllowChangeEvents == true) { if (e.MouseButton == MouseButtons.Right) { EnhancementTreeControl.RemoveSlot(e.SlotIndex); } } }
private void PopulateEnhancementTreeFields() { TreeNameTextBox.Text = TreeModel.Name; TreeBackgoundTextBox.Text = TreeModel.Background; if (TreeModel.RaceTree == true) { RaceRadioButton.Checked = true; } else { ClassRadioButton.Checked = true; } //Let set up the Tree control EnhancementTreeControl.Clear(); if (NewRecord == true) { EnhancementTreeControl.AddSlot(0); SlotChanged[0] = true; //Mark this slot as changed so that it will be saved. as all trees have at least this 1 slot. EnhancementTreeControl.ChangeSlotType(0, SlotControl.SCType.Active); EnhancementTreeControl.BackgroundImage = Image.FromFile(Application.StartupPath + "\\Graphics\\Interface\\" + "BackgroundEmpty" + ".png"); } else { //set up the slot control inside the tree control for (int i = 0; i < 31; i++) { if (SlotModels[i].Id != Guid.Empty) { //TODO: Add the slot and update its Icon if available EnhancementTreeControl.AddSlot(i); if (SlotModels[i].UseEnhancementInfo) { List <EnhancementModel> EnhancementModels; EnhancementModels = new List <EnhancementModel>(); EnhancementModels = EnhancementModel.GetAll(SlotModels[i].Id); if (EnhancementModels.Count > 0) { if (EnhancementModels[0].Icon != null) { EnhancementTreeControl.ChangeSlotIcon(i, EnhancementModels[0].Icon); } else { EnhancementTreeControl.ChangeSlotIcon(i, "noImage"); } } else { EnhancementTreeControl.ChangeSlotIcon(i, "noImageDesign"); } } else if (SlotModels[i].Icon != null) { EnhancementTreeControl.ChangeSlotIcon(i, SlotModels[i].Icon); } if (SlotModels[i].Active == true) { EnhancementTreeControl.ChangeSlotType(i, SlotControl.SCType.Active); } else { EnhancementTreeControl.ChangeSlotType(i, SlotControl.SCType.Passive); } } else { EnhancementTreeControl.ChangeSlotIcon(i, "noImageDesign"); EnhancementTreeControl.ChangeSlotType(i, SlotControl.SCType.Active); } } //set the background image of the tree control. try { EnhancementTreeControl.BackgroundImage = Image.FromFile(Application.StartupPath + "\\Graphics\\Interface\\" + TreeModel.Background + ".png"); } catch (FileNotFoundException) { EnhancementTreeControl.BackgroundImage = Image.FromFile(Application.StartupPath + "\\Graphics\\Interface\\BackgroundEmpty.png"); } } //lets set the index of the tree control //if (EnhancementTreeControl.IsSlotShowing(0) == true) EnhancementTreeControl.SelectedIndex = 0; //else // EnhancementTreeControl.SelectedIndex = -1; //Set the treeName field in the TreeControl EnhancementTreeControl.TreeText = TreeModel.Name; }