示例#1
0
        private void c_MouseLeave(object sender, EventArgs e)
        {
            Control parent = (Control)sender;

            if (parent != SelectedControl)
            {
                IHighlightControl high = (IHighlightControl)parent;
                high.Darken();
            }
        }
示例#2
0
        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);
        }