ComponentFactory.Krypton.Toolkit.SeparatorController.MouseDown C# (CSharp) Méthode

MouseDown() public méthode

Mouse button has been pressed in the view.
public MouseDown ( Control c, Point pt, MouseButtons button ) : bool
c System.Windows.Forms.Control Reference to the source control instance.
pt Point Mouse position relative to control.
button MouseButtons Mouse button pressed down.
Résultat bool
        public override bool MouseDown(Control c, Point pt, MouseButtons button)
        {
            // Let base class process the mouse down
            bool ret = base.MouseDown(c, pt, button);

            // If a change in capturing state has occured
            if (ret != _moving)
            {
                // If we are now capturing input
                if (ret)
                {
                    // Remember the starting mouse position
                    _downPosition = pt;

                    // Remember new capture state
                    _moving = true;

                    // Cache information from the separator
                    _separatorBox = _source.SeparatorMoveBox;
                    _separatorIncrements = _source.SeparatorIncrements;
                    _separatorOrientation = _source.SeparatorOrientation;

                    // Make sure any paint requested by base class has been performed
                    _source.SeparatorControl.Update();

                    // Draw the initial movement indicator
                    Point splitPt = RecalcClient(pt);
                    DrawSeparatorStarting(splitPt);

                    // Register a message filter to intercept the escape key
                    RegisterFilter();
                }
                else
                {
                    // We must have lost capture
                    _moving = false;

                    // Remove the message filter, as long as it is registered
                    // it will prevent the class from being garbage collected.
                    UnregisterFilter();

                    // Callback to the source to show movement has finished
                    Point splitPt = RecalcClient(pt);
                    _source.SeparatorMoved(pt, splitPt);
                }
            }

            return ret;
        }

Usage Example

Exemple #1
0
        internal bool DesignMouseDown(Point pt, MouseButtons button)
        {
            // Remember last point encountered
            _designLastPt = pt;

            // Pass message directly onto the separator controller
            return(_separatorController.MouseDown(this, pt, button));
        }