private void AdjustGridPosition(FilterPosition fromPosition, FilterPosition toPosition)
        {
            if (_grid == null ||
                _filters == null ||
                fromPosition == toPosition)
            {
                return;
            }

            if (_initializing)
            {
                return;
            }

            var newTop    = _grid.Top;
            var newHeight = _grid.Height;

            switch (fromPosition)
            {
            case FilterPosition.Bottom:
                newHeight += _filters.Height;
                break;

            case FilterPosition.Top:
                newTop    -= _filters.Height;
                newHeight += _filters.Height;
                break;
            }

            switch (toPosition)
            {
            case FilterPosition.Bottom:
                newHeight -= _filters.Height;
                break;

            case FilterPosition.Top:
                newTop    += _filters.Height;
                newHeight -= _filters.Height;
                break;
            }

            var oldStyle = _grid.Anchor;

            _grid.Anchor = AnchorStyles.Top | AnchorStyles.Left;
            _grid.SetBounds(0, newTop, 0, newHeight, BoundsSpecified.Y | BoundsSpecified.Height);
            _grid.Anchor = oldStyle;
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BeforeFilterAttribute"/> class.
 /// </summary>
 /// <param name="position">Specify if the filter should be invoked among the first filters, in between or among the last.</param>
 /// <remarks>
 /// BeforeFilters should take no arguments and return false
 /// if controller method should not be invoked.
 /// </remarks>
 public BeforeFilterAttribute(FilterPosition position)
 {
     _position = position;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BeforeFilterAttribute"/> class.
 /// </summary>
 /// <remarks>
 /// BeforeFilters should take no arguments and return false
 /// if controller method should not be invoked.
 /// </remarks>
 public BeforeFilterAttribute()
 {
     _position = FilterPosition.Between;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BeforeFilterAttribute"/> class.
 /// </summary>
 /// <param name="position">Specify if the filter should be invoked among the first filters, in between or among the last.</param>
 /// <remarks>
 /// BeforeFilters should take no arguments and return false
 /// if controller method should not be invoked.
 /// </remarks>
 public BeforeFilterAttribute(FilterPosition position)
 {
     _position = position;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BeforeFilterAttribute"/> class.
 /// </summary>
 /// <remarks>
 /// BeforeFilters should take no arguments and return false
 /// if controller method should not be invoked.
 /// </remarks>
 public BeforeFilterAttribute()
 {
     _position = FilterPosition.Between;
 }
        private void AdjustGridPosition(FilterPosition fromPosition, FilterPosition toPosition)
        {
            if (_grid == null || _filters == null || fromPosition == toPosition)
                return;

            if (_initializing)
                return;

            int newTop = _grid.Top;
            int newHeight = _grid.Height;

            switch (fromPosition)
            {
                case FilterPosition.Bottom:
                    newHeight += _filters.Height;
                    break;
                case FilterPosition.Top:
                    newTop -= _filters.Height;
                    newHeight += _filters.Height;
                    break;
            }

            switch (toPosition)
            {
                case FilterPosition.Bottom:
                    newHeight -= _filters.Height;
                    break;
                case FilterPosition.Top:
                    newTop += _filters.Height;
                    newHeight -= _filters.Height;
                    break;
            }

            AnchorStyles oldStyle = _grid.Anchor;
            _grid.Anchor = AnchorStyles.Top | AnchorStyles.Left;
            _grid.SetBounds(0, newTop, 0, newHeight, BoundsSpecified.Y | BoundsSpecified.Height);
            _grid.Anchor = oldStyle;
        }