/// <summary> /// Click on the Items panel (deselect the selected item) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PContainer_Click(object sender, EventArgs e) { if (this.itemSelected != null) { this.itemSelected.Selected = false; this.itemSelected = null; } }
/// <summary> /// Occurs when a model register has been removed /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void MowayModel_RegisterRemoved(object sender, RegisterEventArgs args) { RegisterListViewItem item = this.registers[args.Register]; this.registers.Remove(args.Register); this.pItems.Controls.Remove(item); this.UpdateItems(); }
/// <summary> /// Add a new register to the list of registers /// </summary> /// <param name="register"></param> private void AddRegisterItem(Register register) { RegisterListViewItem item = new RegisterListViewItem(register); item.Size = new Size(this.pItems.Width - 2, 18); item.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; item.ItemSelected += new EventHandler(Item_ItemSelected); this.registers.Add(register, item); this.pItems.Controls.Add(item); }
/// <summary> /// Selection of an item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Item_ItemSelected(object sender, EventArgs e) { if (this.itemSelected != (RegisterListViewItem)sender) { if (this.itemSelected != null) { this.itemSelected.Selected = false; } this.itemSelected = (RegisterListViewItem)sender; } }