Project/02 - Engine/LittleBigTools/UserControls/NumericUpDownTextBox.xaml.cs
/// <summary>
/// Called to arrange and size the content of a 
///         System.Windows.Controls.Control object.
/// </summary>
/// <param name="arrangeSize">The computed size that is used to 
///                 arrange the content</param>
/// <returns>The size of the control</returns>
Called to arrange and size the content of a
System.Windows.Controls.Control object.
Called to arrange and size the content of a System . Windows . Controls . Control object .
protected override Size ArrangeOverride(Size arrangeSize)
        {
            double height = arrangeSize.Height;
            double width = arrangeSize.Width;
            showButtons = width > 1.5 * height;
            if (showButtons)
            {
                double buttonWidth = 3 * height / 4;
                Size buttonSize = new Size(buttonWidth, height / 2);
                Size textBoxSize = new Size(width - buttonWidth, height);
                double buttonsLeft = width - buttonWidth;
                Rect upButtonRect = new Rect(new 
                    System.Windows.Point(buttonsLeft, 0), buttonSize);
                Rect downButtonRect = new Rect(new
                    System.Windows.Point(buttonsLeft, height / 2), buttonSize);
                base.ArrangeOverride(textBoxSize);
                upButton.Arrange(upButtonRect);
                downButton.Arrange(downButtonRect);
                return arrangeSize;
            }
            else
            {
                return base.ArrangeOverride(arrangeSize);
            }
        }
protected override Size ArrangeOverride ( Size arrangeSize ) { double height = arrangeSize . Height ; double width = arrangeSize . Width ; showButtons = width > 1.5 * height ; if ( showButtons ) { double buttonWidth = 3 * height / 4 ; Size buttonSize = new Size ( buttonWidth , height / 2 ) ; Size textBoxSize = new Size ( width - buttonWidth , height ) ; double buttonsLeft = width - buttonWidth ; Rect upButtonRect = new Rect ( new System . Windows . Point ( buttonsLeft , 0 ) , buttonSize ) ; Rect downButtonRect = new Rect ( new System . Windows . Point ( buttonsLeft , height / 2 ) , buttonSize ) ; base . ArrangeOverride ( textBoxSize ) ; upButton . Arrange ( upButtonRect ) ; downButton . Arrange ( downButtonRect ) ; return arrangeSize ; } else { return base . ArrangeOverride ( arrangeSize ) ; } }
Called to arrange and size the content of a
System.Windows.Controls.Control object.
Called to arrange and size the content of a System . Windows . Controls . Control object .
The size of the control
The size of the control
arrangeSize
Size
The computed size that is used to
arrange the content
The computed size that is used to arrange the content