コード例 #1
0
        private void OnResize(object sender, ResizeBarEventArgs e)
        {
            if (!_isResizing)
            {
                OnResizeStarted(e);
            }

            UpdateWindowSize(e);

            int  rows, columns;
            Size originalSize = _currentSize;

            CalculateMatrixDimensions(out rows, out columns);

            if (originalSize != _currentSize)
            {
                _parent.widgetContainer.Source.Resize(
                    rows, columns,
                    e.ThumbId == ThumbId.Left ? Data.WidgetContainerResizeJustify.Right :
                    Data.WidgetContainerResizeJustify.Left);

                _parent.widgetContainer.MinHeight += _currentSize.Height - originalSize.Height;
                _parent.widgetContainer.MinWidth  += _currentSize.Width - originalSize.Width;
            }
        }
コード例 #2
0
        private void UpdateWindowSize(ResizeBarEventArgs e)
        {
            double newWidth  = _parent.ActualWidth + e.WidthDelta;
            double newHeight = _parent.ActualHeight + e.HeightDelta;
            double newLeft   = _parent.Left + e.LeftDelta;

            if (newHeight < _minimumSize.Height)
            {
                newHeight = _minimumSize.Height;
            }

            if (newWidth < _minimumSize.Width)
            {
                if (e.LeftDelta != 0.0)
                {
                    newLeft -= _minimumSize.Width - newWidth;
                }

                newWidth = _minimumSize.Width;
            }

            _parent.Left   = newLeft;
            _parent.Width  = newWidth;
            _parent.Height = newHeight;
        }
コード例 #3
0
        private void OnResizeStarted(ResizeBarEventArgs e)
        {
            _isResizing  = true;
            _currentSize = new Size(_parent.ActualWidth, _parent.ActualHeight);

            // We set min width/height on widget container element so that it remains static when the user
            // sizes the main window to be smaller than what's needed to display the entire widget container.
            _parent.widgetContainer.MinHeight = _parent.widgetContainer.ActualHeight;
            _parent.widgetContainer.MinWidth  = _parent.widgetContainer.ActualWidth;

            _parent.widgetContainer.HorizontalAlignment =
                e.ThumbId == ThumbId.Left ? HorizontalAlignment.Right : HorizontalAlignment.Left;

            _minimumSize = CalculateMinimumSize(e.ThumbId == ThumbId.Left);
        }
コード例 #4
0
ファイル: MainWindowResizer.cs プロジェクト: dxm007/Droppy
        private void UpdateWindowSize( ResizeBarEventArgs e )
        {
            double newWidth = _parent.ActualWidth + e.WidthDelta;
            double newHeight = _parent.ActualHeight + e.HeightDelta;
            double newLeft = _parent.Left + e.LeftDelta;

            if( newHeight < _minimumSize.Height ) newHeight = _minimumSize.Height;

            if( newWidth < _minimumSize.Width )
            {
                if( e.LeftDelta != 0.0 ) newLeft -= _minimumSize.Width - newWidth;

                newWidth = _minimumSize.Width;
            }

            _parent.Left = newLeft;
            _parent.Width = newWidth;
            _parent.Height = newHeight;
        }
コード例 #5
0
ファイル: MainWindowResizer.cs プロジェクト: dxm007/Droppy
        private void OnResizeStarted( ResizeBarEventArgs e )
        {
            _isResizing = true;
            _currentSize = new Size( _parent.ActualWidth, _parent.ActualHeight );

            // We set min width/height on widget container element so that it remains static when the user
            // sizes the main window to be smaller than what's needed to display the entire widget container.
            _parent.widgetContainer.MinHeight = _parent.widgetContainer.ActualHeight;
            _parent.widgetContainer.MinWidth = _parent.widgetContainer.ActualWidth;

            _parent.widgetContainer.HorizontalAlignment =
                e.ThumbId == ThumbId.Left ? HorizontalAlignment.Right : HorizontalAlignment.Left;

            _minimumSize = CalculateMinimumSize( e.ThumbId == ThumbId.Left );
        }
コード例 #6
0
ファイル: MainWindowResizer.cs プロジェクト: dxm007/Droppy
        private void OnResize( object sender, ResizeBarEventArgs e )
        {
            if( !_isResizing ) OnResizeStarted( e );

            UpdateWindowSize( e );

            int rows, columns;
            Size originalSize = _currentSize;

            CalculateMatrixDimensions( out rows, out columns );

            if( originalSize != _currentSize )
            {
                _parent.widgetContainer.Source.Resize(
                            rows, columns,
                            e.ThumbId == ThumbId.Left ? Data.WidgetContainerResizeJustify.Right :
                                                        Data.WidgetContainerResizeJustify.Left );

                _parent.widgetContainer.MinHeight += _currentSize.Height - originalSize.Height;
                _parent.widgetContainer.MinWidth += _currentSize.Width - originalSize.Width;
            }
        }