Exemplo n.º 1
0
        /// <summary>
        /// Overrides the <c>MouseDown</c> handler on this <c>YataPanelCols</c>.
        /// Accepts or cancels the editor based on
        /// <c><see cref="Settings._acceptedit">Settings._acceptedit</see></c>.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
#if Clicks
            logfile.Log("YataPanelCols.OnMouseDown() e.Button= " + e.Button);
#endif
            // Don't bother checking MouseButton or ModifierKeys.

            if (_grid._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid._editor.Visible");
#endif
                _grid._editor.Visible = false;
            }
            else if (_grid.Propanel != null && _grid.Propanel._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid.Propanel._editor.Visible");
#endif
                _grid.Propanel._editor.Visible = false;
            }
            _grid.Select();


            switch (e.Button)
            {
            case MouseButtons.Left:
                IsGrab = ModifierKeys == Keys.None && IsCursorSplit;
#if Clicks
                logfile.Log(". IsGrab= " + IsGrab + " _grabCol= " + _grabCol);
#endif
                break;

            case MouseButtons.Right:
                if (ModifierKeys == Keys.None && IsCursorSplit)
                {
                    Col col = _grid.Cols[_grabCol];
                    if (col.UserSized)
                    {
#if Clicks
                        logfile.Log(". reset col-width _grabCol= " + _grabCol);
#endif
                        col.UserSized = false;
                        _grid.Colwidth(_grabCol);
                        _grid.Invalidator(YataGrid.INVALID_GRID | YataGrid.INVALID_COLS);
                    }
                }
                break;
            }

            _grid.click_ColheadPanel(e);
        }