//action for when mouse click on close button protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); int indexOfThisToken = Parent.Controls.IndexOf(this); if (rCloseX.Contains(e.Location) && e.Button == MouseButtons.Left) { Parent.Controls.RemoveAt(indexOfThisToken); } else { if (NotifyParentEvent != null) { TokenEventArgs tokenEventArgs = new TokenEventArgs(this.Text, indexOfThisToken, this.TokenItem, e.Button); NotifyParentEvent(tokenEventArgs); } } }
public void OnTokenClicked(TokenEventArgs tokenEventArgs) { TokenClicked?.Invoke(null, tokenEventArgs); }