protected override bool OnMouseDown(MouseEventArgs eventArgs)
        {
            Point point = new Point(eventArgs.X, eventArgs.Y);

            this.Refresh();
            this.UpdateTransparency(point);
            bool flag = false;

            if ((eventArgs.Button & MouseButtons.Left) > MouseButtons.None)
            {
                for (int i = this.actions.Count - 1; i >= 0; i--)
                {
                    DynamicAction action = this.actions[i];
                    if (this.GetActionBounds(i).Contains(point))
                    {
                        for (int j = 0; j < action.Buttons.Count; j++)
                        {
                            if (this.GetButtonBounds(i, j).Contains(point) && (action.Buttons[j].State == ActionButton.States.Disabled))
                            {
                                return(true);
                            }
                        }
                        for (int k = 0; k < action.Buttons.Count; k++)
                        {
                            ActionButton button = action.Buttons[k];
                            if (button.State != ActionButton.States.Disabled)
                            {
                                if (this.GetButtonBounds(i, k).Contains(point))
                                {
                                    button.State = ActionButton.States.Pressed;
                                    if (action.ActionType != DynamicAction.ActionTypes.TwoState)
                                    {
                                        this.SetDraggedButton(i, k);
                                    }
                                }
                                else if (action.ActionType == DynamicAction.ActionTypes.TwoState)
                                {
                                    button.State = ActionButton.States.Normal;
                                }
                            }
                        }
                        flag = true;
                    }
                }
            }
            return(flag);
        }
 private DynamicAction CreateDynamicAction()
 {
     DynamicAction action = new DynamicAction {
         ButtonSize = DynamicAction.ButtonSizes.Large,
         DockAlignment = DesignerContentAlignment.BottomRight,
         DockMargin = new Size(5, 5)
     };
     ActionButton item = new ActionButton(new Image[] { DR.GetImage("FitToScreen") as Bitmap });
     item.StateChanged += new EventHandler(this.OnFitToScreen);
     action.Buttons.Add(item);
     return action;
 }
예제 #3
0
        private DynamicAction CreateDynamicAction()
        {
            DynamicAction fitAllAction = new DynamicAction();
            fitAllAction.ButtonSize = DynamicAction.ButtonSizes.Large;
            fitAllAction.DockAlignment = DesignerContentAlignment.BottomRight;
            fitAllAction.DockMargin = new Size(5, 5);

            ActionButton fitallButton = new ActionButton(new Image[] { DR.GetImage(DR.FitToScreen) as Bitmap });
            fitallButton.StateChanged += new EventHandler(OnFitToScreen);
            fitAllAction.Buttons.Add(fitallButton);

            return fitAllAction;
        }
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            Point clientPoint = new Point(eventArgs.X, eventArgs.Y);

            Refresh();
            UpdateTransparency(clientPoint);

            string infoTip = String.Empty;
            bool   retval  = IsButtonDragged;

            if (!IsButtonDragged)
            {
                for (int i = this.actions.Count - 1; i >= 0; i--)
                {
                    DynamicAction action       = this.actions[i];
                    Rectangle     actionBounds = GetActionBounds(i);

                    for (int j = 0; j < action.Buttons.Count; j++)
                    {
                        ActionButton actionButton = action.Buttons[j];

                        if (actionBounds.Contains(clientPoint))
                        {
                            Rectangle buttonBounds        = GetButtonBounds(i, j);
                            bool      buttonContainsPoint = buttonBounds.Contains(clientPoint);

                            if (buttonContainsPoint && infoTip.Length == 0)
                            {
                                infoTip = actionButton.Description;
                            }

                            if (actionButton.State != ActionButton.States.Disabled &&
                                actionButton.State != ActionButton.States.Pressed)
                            {
                                if (buttonContainsPoint)
                                {
                                    actionButton.State = ActionButton.States.Highlight;
                                }
                                else
                                {
                                    actionButton.State = ActionButton.States.Normal;
                                }
                            }

                            retval = true;
                        }
                        else
                        {
                            if (actionButton.State == ActionButton.States.Highlight)
                            {
                                actionButton.State = ActionButton.States.Normal;
                            }
                        }
                    }
                }
            }

            WorkflowView parentView = ParentView;

            if (infoTip.Length > 0)
            {
                this.infoTipSet = true;
                parentView.ShowInfoTip(infoTip);
            }
            else if (this.infoTipSet)
            {
                parentView.ShowInfoTip(String.Empty);
                this.infoTipSet = false;
            }

            return(retval);
        }