Пример #1
0
 void handler_MouseLeftUpGlobal(object sender, MouseEventArgGlobal e)
 {
     if (!this.ContainsFocus)
     {
         return;
     }
     this.resizeMode = ResizeMode.N;
 }
Пример #2
0
 void handler_MouseLeftDownGlobal(object sender, MouseEventArgGlobal e)
 {
     if (!this.ContainsFocus)
         return;
     if (this.Cursor == Cursors.SizeWE)
         this.resizeMode = ResizeMode.H;
     else if (this.Cursor == Cursors.SizeNS)
         this.resizeMode = ResizeMode.V;
     else if (this.Cursor == Cursors.SizeNWSE)
         this.resizeMode = ResizeMode.B;
     else
         this.resizeMode = ResizeMode.N;
 }
Пример #3
0
        void handler_MouseMoveGlobal(object sender, MouseEventArgGlobal e)
        {
            if (!this.ContainsFocus)
            {
                return;
            }
            var point = PointToClient(MousePosition);

            switch (this.resizeMode)
            {
            case ResizeMode.N:
                int i   = 0;
                var cur = Cursors.Arrow;
                if (Math.Abs(point.X - (this.ChildPanelControl.Location.X + this.ChildPanelControl.Width)) < 5)
                {
                    cur = Cursors.SizeWE;
                    i++;
                }
                if (Math.Abs(point.Y - (this.ChildPanelControl.Location.Y + this.ChildPanelControl.Height)) < 5)
                {
                    cur = Cursors.SizeNS;
                    i++;
                }
                if (i == 2)
                {
                    cur = Cursors.SizeNWSE;
                }
                this.Cursor = cur;
                break;

            case ResizeMode.H:
                int newWidth = point.X - this.ChildPanelControl.Location.X;
                this.ChildPanelControl.Width = newWidth > 10 ? newWidth : 10;
                break;

            case ResizeMode.V:
                int newHeight = point.Y - this.ChildPanelControl.Location.Y;
                this.ChildPanelControl.Height = newHeight > 10 ? newHeight : 10;
                break;

            case ResizeMode.B:
                newWidth = point.X - this.ChildPanelControl.Location.X;
                this.ChildPanelControl.Width = newWidth > 10 ? newWidth : 10;
                newHeight = point.Y - this.ChildPanelControl.Location.Y;
                this.ChildPanelControl.Height = newHeight > 10 ? newHeight : 10;
                break;
            }
        }
Пример #4
0
 void handler_MouseLeftDownGlobal(object sender, MouseEventArgGlobal e)
 {
     if (!this.ContainsFocus)
     {
         return;
     }
     if (this.Cursor == Cursors.SizeWE)
     {
         this.resizeMode = ResizeMode.H;
     }
     else if (this.Cursor == Cursors.SizeNS)
     {
         this.resizeMode = ResizeMode.V;
     }
     else if (this.Cursor == Cursors.SizeNWSE)
     {
         this.resizeMode = ResizeMode.B;
     }
     else
     {
         this.resizeMode = ResizeMode.N;
     }
 }
Пример #5
0
 void handler_MouseMoveGlobal(object sender, MouseEventArgGlobal e)
 {
     if (!this.ContainsFocus)
         return;
     var point = PointToClient(MousePosition);
     switch (this.resizeMode)
     {
         case ResizeMode.N:
             int i = 0;
             var cur = Cursors.Arrow;
             if (Math.Abs(point.X - (this.ChildPanelControl.Location.X + this.ChildPanelControl.Width)) < 5)
             {
                 cur = Cursors.SizeWE;
                 i++;
             }
             if (Math.Abs(point.Y - (this.ChildPanelControl.Location.Y + this.ChildPanelControl.Height)) < 5)
             {
                 cur = Cursors.SizeNS;
                 i++;
             }
             if (i == 2)
                 cur = Cursors.SizeNWSE;
             this.Cursor = cur;
             break;
         case ResizeMode.H:
             int newWidth = point.X - this.ChildPanelControl.Location.X;
             this.ChildPanelControl.Width = newWidth > 10 ? newWidth : 10;
             break;
         case ResizeMode.V:
             int newHeight = point.Y - this.ChildPanelControl.Location.Y;
             this.ChildPanelControl.Height = newHeight > 10 ? newHeight : 10;
             break;
         case ResizeMode.B:
             newWidth = point.X - this.ChildPanelControl.Location.X;
             this.ChildPanelControl.Width = newWidth > 10 ? newWidth : 10;
             newHeight = point.Y - this.ChildPanelControl.Location.Y;
             this.ChildPanelControl.Height = newHeight > 10 ? newHeight : 10;
             break;
     }
 }
Пример #6
0
 void handler_MouseLeftUpGlobal(object sender, MouseEventArgGlobal e)
 {
     if (!this.ContainsFocus)
         return;
     this.resizeMode = ResizeMode.N;
 }