コード例 #1
0
        /// <summary>
        /// Called when mouse moves over left border
        /// </summary>
        /// <param name="source">Event source</param>
        /// <param name="args">The <see cref="System.Windows.Input.MouseEventArgs"/> instance containing the event data</param>
        private void OnLeftBorderMouseMove(object source, MouseEventArgs args)
        {
            if ((!LeftBorder.IsMouseCaptured) && IsResizing)
            {
                LeftBorder.CaptureMouse();
            }

            if (IsResizing)
            {
                double position = args.GetPosition(this).X;

                if (System.Math.Abs(position) < 10)
                {
                    return;
                }

                if ((position > 0) && ((Width - position) > MinWidth) && (Width > position))
                {
                    Left  += position;
                    Width -= position;
                }
                else if ((position < 0) && (Left > 0))
                {
                    position = (Left + position > 0) ? position : -1 * Left;
                    Width    = ActualWidth - position;
                    Left    += position;
                }
            }
        }