Exemplo n.º 1
0
        private void OutlookBar_Click(object sender, EventArgs e)
        {
            if (!(e is MouseEventArgs))
            {
                return;
            }

            // case to MouseEventArgs so position and mousebutton clicked can be used
            MouseEventArgs mea = (MouseEventArgs)e;

            // only continue if left mouse button was clicked
            if (mea.Button != MouseButtons.Left)
            {
                return;
            }

            int index = (mea.Y - 1) / (buttonHeight + 1);

            if (index < 0 || index >= buttons.Count)
            {
                return;
            }

            OutlookBarButton button = buttons[index];

            if (button == null)
            {
                return;
            }
            if (!button.Enabled)
            {
                return;
            }

            // ok, all checks passed so assign the new selected button
            // and raise the event
            SelectedButton = button;

            ButtonClickEventArgs bce = new ButtonClickEventArgs(selectedButton, mea);

            if (Click != null) // only invoke on left mouse click
            {
                Click.Invoke(this, bce);
            }
        }
Exemplo n.º 2
0
 public void Remove(OutlookBarButton button)
 {
     List.Remove(button);
     Parent.ButtonlistChanged();
 }
Exemplo n.º 3
0
 public ButtonClickEventArgs(OutlookBarButton button, MouseEventArgs evt) : base(evt.Button, evt.Clicks, evt.X, evt.Y, evt.Delta)
 {
     SelectedButton = button;
 }