ComponentFactory.Krypton.Docking.KryptonAutoHiddenSlidePanel.UpdateSize C# (CSharp) Method

UpdateSize() public method

Update the size and position of the slide out panel.
public UpdateSize ( int width, int height ) : void
width int Delta width to apply.
height int Delta height to apply.
return void
        public void UpdateSize(int width, int height)
        {
            // Can only apply change when fully showing
            if (_state == DockingAutoHiddenShowState.Showing)
            {
                switch (_edge)
                {
                    case DockingEdge.Left:
                        _endRect.Width += width;
                        _inner.SetBounds(0, 0, _inner.Width + width, _inner.Height);
                        SetBounds(Left, Top, Width + width, Height);

                        // Update the page with the new size to use in the future
                        if (_page != null)
                            _page.AutoHiddenSlideSize = new Size(_page.AutoHiddenSlideSize.Width + width, _page.AutoHiddenSlideSize.Height);
                        break;
                    case DockingEdge.Right:
                        _endRect.X += width;
                        _endRect.Width -= width;
                        _inner.SetBounds(0, 0, _inner.Width - width, _inner.Height);
                        SetBounds(Left + width, Top, Width - width, Height);

                        // Update the page with the new size to use in the future
                        if (_page != null)
                            _page.AutoHiddenSlideSize = new Size(_page.AutoHiddenSlideSize.Width - width, _page.AutoHiddenSlideSize.Height);
                        break;
                    case DockingEdge.Top:
                        _endRect.Height += width;
                        _inner.SetBounds(0, 0, _inner.Width, _inner.Height + height);
                        SetBounds(Left, Top, Width, Height + height);

                        // Update the page with the new size to use in the future
                        if (_page != null)
                            _page.AutoHiddenSlideSize = new Size(_page.AutoHiddenSlideSize.Width, _page.AutoHiddenSlideSize.Height + height);
                        break;
                    case DockingEdge.Bottom:
                        _endRect.Y += height;
                        _endRect.Height -= height;
                        _inner.SetBounds(0, 0, _inner.Width, _inner.Height - height);
                        SetBounds(Left, Top + height, Width, Height - height);

                        // Update the page with the new size to use in the future
                        if (_page != null)
                            _page.AutoHiddenSlideSize = new Size(_page.AutoHiddenSlideSize.Width, _page.AutoHiddenSlideSize.Height - height);
                        break;
                }
            }
        }

Usage Example

Beispiel #1
0
 private void OnSlidePanelSeparatorMoved(object sender, SplitterEventArgs e)
 {
     _slidePanel.UpdateSize(e.SplitX, e.SplitY);
 }