void OutlookBar_Click(object sender, EventArgs e) { // case to MouseEventArgs so position and mousebutton clicked can be used MouseEventArgs mea = e as MouseEventArgs; if (mea == null) { return; } // only continue if left mouse button was clicked if (mea.Button != MouseButtons.Left) { return; } int index = (mea.Y - 1) / (buttonBarHeight + 1); if (index < 0 || index >= listButtons.Count) { return; } OutlookBarButton button = listButtons[index]; if (button == null || !button.Enabled) { return; } // ok, all checks passed so assign the new selected button // and raise the event SelectedButton = button; ButtonClickEventArgs bce = new ButtonClickEventArgs(selectedButtonBar, mea); if (Click != null) // only invoke on left mouse click { Click.Invoke(this, bce); } }
public ButtonSelectEventArgs(OutlookBarButton button) { SelectedButton = button; }
public ButtonClickEventArgs(OutlookBarButton button, MouseEventArgs evt) : base(evt.Button, evt.Clicks, evt.X, evt.Y, evt.Delta) { SelectedButton = button; }
public int IndexOf(OutlookBarButton value) { return(List.IndexOf(value)); }