/// <summary>
 /// Raises the SplitterMoving event.
 /// </summary>
 /// <param name="e">A LightweightSplitterEventArgs that contains the event data.</param>
 protected virtual void OnSplitterMoving(LightweightSplitterEventArgs e)
 {
     if (SplitterMoving != null)
     {
         SplitterMoving(this, e);
     }
 }
 /// <summary>
 /// Raises the SplitterEndMove event.
 /// </summary>
 /// <param name="e">A LightweightSplitterEventArgs that contains the event data.</param>
 protected virtual void OnSplitterEndMove(LightweightSplitterEventArgs e)
 {
     if (SplitterEndMove != null)
     {
         SplitterEndMove(this, e);
     }
 }
        /// <summary>
        /// Helper to adjust the Position in the LightweightSplitterEventArgs for the vertical splitter.
        /// </summary>
        /// <param name="e">LightweightSplitterEventArgs to adjust.</param>
        private void AdjustVerticalLightweightSplitterEventArgsPosition(ref LightweightSplitterEventArgs e)
        {
            //	If the vertical splitter style is non, we shouldn't receive this event.
            Debug.Assert(verticalSplitterStyle != VerticalSplitterStyle.None);
            if (verticalSplitterStyle == VerticalSplitterStyle.None)
            {
                return;
            }

            //	Left or right splitter style.
            if (verticalSplitterStyle == VerticalSplitterStyle.Left)
            {
                if (e.Position < 0)
                {
                    if (Math.Abs(e.Position) > MaximumWidthIncrease)
                    {
                        e.Position = MaximumWidthIncrease * -1;
                    }
                }
                else
                {
                    if (e.Position > MaximumWidthDecrease)
                    {
                        e.Position = MaximumWidthDecrease;
                    }
                }
            }
            else if (verticalSplitterStyle == VerticalSplitterStyle.Right)
            {
                if (e.Position > 0)
                {
                    if (e.Position > MaximumWidthIncrease)
                    {
                        e.Position = MaximumWidthIncrease;
                    }
                }
                else
                {
                    if (Math.Abs(e.Position) > MaximumWidthDecrease)
                    {
                        e.Position = MaximumWidthDecrease * -1;
                    }
                }
            }
        }
        /// <summary>
        /// Helper to adjust the Position in the LightweightSplitterEventArgs for the horizontal splitter.
        /// </summary>
        /// <param name="e">LightweightSplitterEventArgs to adjust.</param>
        private void AdjustHorizontalLightweightSplitterEventArgsPosition(ref LightweightSplitterEventArgs e)
        {
            int horizontalSplitterLayoutPosition = HorizontalSplitterLayoutPosition;

            if (e.Position < 0)
            {
                if (HorizontalSplitterLayoutPosition + e.Position < MinimumHorizontalSplitterLayoutPosition)
                {
                    e.Position = MinimumHorizontalSplitterLayoutPosition - horizontalSplitterLayoutPosition;
                }
            }
            else
            {
                if (HorizontalSplitterLayoutPosition + e.Position > MaximumHorizontalSplitterLayoutPosition)
                {
                    e.Position = MaximumHorizontalSplitterLayoutPosition - horizontalSplitterLayoutPosition;
                }
            }
        }
 /// <summary>
 /// Raises the SplitterMoving event.
 /// </summary>
 /// <param name="e">A LightweightSplitterEventArgs that contains the event data.</param>
 protected virtual void OnSplitterMoving(LightweightSplitterEventArgs e)
 {
     if (SplitterMoving != null)
         SplitterMoving(this, e);
 }
 /// <summary>
 /// Raises the SplitterEndMove event.
 /// </summary>
 /// <param name="e">A LightweightSplitterEventArgs that contains the event data.</param>
 protected virtual void OnSplitterEndMove(LightweightSplitterEventArgs e)
 {
     if (SplitterEndMove != null)
         SplitterEndMove(this, e);
 }
        /// <summary>
        /// Helper to adjust the Position in the LightweightSplitterEventArgs for the vertical splitter.
        /// </summary>
        /// <param name="e">LightweightSplitterEventArgs to adjust.</param>
        private void AdjustVerticalLightweightSplitterEventArgsPosition(ref LightweightSplitterEventArgs e)
        {
            //	If the vertical splitter style is non, we shouldn't receive this event.
            Debug.Assert(verticalSplitterStyle != VerticalSplitterStyle.None);
            if (verticalSplitterStyle == VerticalSplitterStyle.None)
                return;

            //	Left or right splitter style.
            if (verticalSplitterStyle == VerticalSplitterStyle.Left)
            {
                if (e.Position < 0)
                {
                    if (Math.Abs(e.Position) > MaximumWidthIncrease)
                        e.Position = MaximumWidthIncrease * -1;
                }
                else
                {
                    if (e.Position > MaximumWidthDecrease)
                        e.Position = MaximumWidthDecrease;
                }
            }
            else if (verticalSplitterStyle == VerticalSplitterStyle.Right)
            {
                if (e.Position > 0)
                {
                    if (e.Position > MaximumWidthIncrease)
                        e.Position = MaximumWidthIncrease;
                }
                else
                {
                    if (Math.Abs(e.Position) > MaximumWidthDecrease)
                        e.Position = MaximumWidthDecrease * -1;
                }
            }
        }
        /// <summary>
        /// splitterLightweightControlHorizontal_SplitterMoving event handler.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        private void splitterLightweightControlHorizontal_SplitterMoving(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                AdjustHorizontalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the horizontal splitter position.
                HorizontalSplitterPosition += (double)e.Position / PaneLayoutHeight;

                //	Update manually to keep the screen as up to date as possible.
                Update();
            }

            //	Raise the HorizontalSplitterMoving event.
            OnHorizontalSplitterMoving(EventArgs.Empty);
        }
        /// <summary>
        /// splitterLightweightControlHorizontal_SplitterEndMove event handler.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        private void splitterLightweightControlHorizontal_SplitterEndMove(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                //	Adjust the horizontal splitter position.
                AdjustHorizontalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the horizontal splitter position.
                HorizontalSplitterPosition += (double)e.Position / PaneLayoutHeight;
            }

            //	Raise the HorizontalSplitterEndMove event.
            OnHorizontalSplitterEndMove(EventArgs.Empty);
        }
        /// <summary>
        /// splitterLightweightControlVertical_SplitterMoving event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void splitterLightweightControlVertical_SplitterMoving(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                //	Adjust the splitter position.
                AdjustVerticalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the preferred column width - in real time.
                if (verticalSplitterStyle == VerticalSplitterStyle.Left)
                    PreferredColumnWidth -= e.Position;
                else if (verticalSplitterStyle == VerticalSplitterStyle.Right)
                    PreferredColumnWidth += e.Position;

                //	Update manually to keep the screen as up to date as possible.
                Update();
            }

            //	Raise the VerticalSplitterMoving event.
            OnVerticalSplitterMoving(EventArgs.Empty);
        }
        /// <summary>
        /// splitterLightweightControlVertical_SplitterEndMove event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void splitterLightweightControlVertical_SplitterEndMove(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                //	Adjust the vertical splitter position.
                AdjustVerticalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the preferred column width.
                if (verticalSplitterStyle == VerticalSplitterStyle.Left)
                    PreferredColumnWidth -= e.Position;
                else if (verticalSplitterStyle == VerticalSplitterStyle.Right)
                    PreferredColumnWidth += e.Position;
            }

            //	Raise the VerticalSplitterEndMove event.
            OnVerticalSplitterEndMove(EventArgs.Empty);
        }
 /// <summary>
 /// Helper to adjust the Position in the LightweightSplitterEventArgs for the horizontal splitter.
 /// </summary>
 /// <param name="e">LightweightSplitterEventArgs to adjust.</param>
 private void AdjustHorizontalLightweightSplitterEventArgsPosition(ref LightweightSplitterEventArgs e)
 {
     int horizontalSplitterLayoutPosition = HorizontalSplitterLayoutPosition;
     if (e.Position < 0)
     {
         if (HorizontalSplitterLayoutPosition + e.Position < MinimumHorizontalSplitterLayoutPosition)
             e.Position = MinimumHorizontalSplitterLayoutPosition - horizontalSplitterLayoutPosition;
     }
     else
     {
         if (HorizontalSplitterLayoutPosition + e.Position > MaximumHorizontalSplitterLayoutPosition)
             e.Position = MaximumHorizontalSplitterLayoutPosition - horizontalSplitterLayoutPosition;
     }
 }
        /// <summary>
        /// splitterLightweightControlHorizontal_SplitterMoving event handler.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        private void splitterLightweightControlHorizontal_SplitterMoving(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                AdjustHorizontalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the horizontal splitter position.
                HorizontalSplitterPosition += (double)e.Position / PaneLayoutHeight;

                //	Update manually to keep the screen as up to date as possible.
                Update();
            }

            //	Raise the HorizontalSplitterMoving event.
            OnHorizontalSplitterMoving(EventArgs.Empty);
        }
        /// <summary>
        /// splitterLightweightControlHorizontal_SplitterEndMove event handler.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        private void splitterLightweightControlHorizontal_SplitterEndMove(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                //	Adjust the horizontal splitter position.
                AdjustHorizontalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the horizontal splitter position.
                HorizontalSplitterPosition += (double)e.Position / PaneLayoutHeight;
            }

            //	Raise the HorizontalSplitterEndMove event.
            OnHorizontalSplitterEndMove(EventArgs.Empty);
        }
        /// <summary>
        /// splitterLightweightControlVertical_SplitterMoving event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void splitterLightweightControlVertical_SplitterMoving(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                //	Adjust the splitter position.
                AdjustVerticalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the preferred column width - in real time.
                if (verticalSplitterStyle == VerticalSplitterStyle.Left)
                {
                    PreferredColumnWidth -= e.Position;
                }
                else if (verticalSplitterStyle == VerticalSplitterStyle.Right)
                {
                    PreferredColumnWidth += e.Position;
                }

                //	Update manually to keep the screen as up to date as possible.
                Update();
            }

            //	Raise the VerticalSplitterMoving event.
            OnVerticalSplitterMoving(EventArgs.Empty);
        }
        /// <summary>
        /// splitterLightweightControlVertical_SplitterEndMove event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void splitterLightweightControlVertical_SplitterEndMove(object sender, LightweightSplitterEventArgs e)
        {
            //	If the splitter has moved.
            if (e.Position != 0)
            {
                //	Adjust the vertical splitter position.
                AdjustVerticalLightweightSplitterEventArgsPosition(ref e);

                //	Adjust the preferred column width.
                if (verticalSplitterStyle == VerticalSplitterStyle.Left)
                {
                    PreferredColumnWidth -= e.Position;
                }
                else if (verticalSplitterStyle == VerticalSplitterStyle.Right)
                {
                    PreferredColumnWidth += e.Position;
                }
            }

            //	Raise the VerticalSplitterEndMove event.
            OnVerticalSplitterEndMove(EventArgs.Empty);
        }