using System.Windows.Forms;
using System.Drawing;

namespace NotepadEnhanced.GUI.Controls
{
    class ControlExtender : Control
    {
        private Point _lastClick;

        public ControlExtender()
        {
            base.Cursor = Cursors.SizeNS;
            this.SetStyle(ControlStyles.Selectable, false);
        }

        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            _lastClick = e.Location;
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (MouseButtons.Left == e.Button)
            {
                this.Parent.Height -= e.Y - _lastClick.Y;
                this.Parent.Top += e.Y - _lastClick.Y;
            }
        }
    }
}
