private void c_MouseLeave(object sender, EventArgs e) { Control parent = (Control)sender; if (parent != SelectedControl) { IHighlightControl high = (IHighlightControl)parent; high.Darken(); } }
private void c_Click(object sender, EventArgs e) { Control parent = (Control)sender; for (int i = 0; i < this.Controls.Count; i++) { Control c = this.Controls[i]; if (c is IHighlightControl) { IHighlightControl high = (IHighlightControl)c; if (parent == c) { // highlight high.Highlight(); } else { high.Darken(); } } } if (parent != null && parent != SelectedControl) { if (this.SelectedChanged != null) { SelectedControl = parent; this.SelectedChanged(SelectedControl, this); } } SelectedControl = parent; this.OnClick(e); }