コード例 #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            ReminderHitInfo hitInfo = CalcHitInfo(e.Location);

            HotTrackButtonInfo = null;
            UpdateButton(hitInfo, State.Pressed);
            if (HotTrackButtonInfo != null)
            {
                ButtonClickEventArgs eventArgs = new ButtonClickEventArgs()
                {
                    Handled = false, Button = HotTrackButtonInfo.Owner
                };
                RaiseButtonClick(this, eventArgs);
                if (!eventArgs.Handled)
                {
                    if (eventArgs.Button.Kind == ButtonKind.HeaderAdd)
                    {
                        Notes.AddNote("New Note", DateTime.Now, RepeatMode.EveryDay);
                        ReminderListBox.SelectedIndex = ReminderListBox.Items.Count - 1;
                    }
                    else if (eventArgs.Button.Kind == ButtonKind.Note)
                    {
                        View = ViewKind.Edit;
                    }
                    else
                    {
                        View = ViewKind.View;
                    }
                }
            }
        }
コード例 #2
0
        protected virtual void RaiseButtonClick(System.Object sender, ButtonClickEventArgs ea)
        {
            ButtonClickEventHandler handler = ButtonClick;

            if (handler != null)
            {
                handler(sender, ea);
            }
        }