Ejemplo n.º 1
0
        private void CMDFrame_MouseDragMove(object sender, MouseEventArgs e)
        {
            if (dragMove.HasValue)
            {
                int difX = e.X - dragMove.Value.X;
                int difY = e.Y - dragMove.Value.Y;

                Location += new Size(difX, difY);
                if (Location.X < 0)
                {
                    Location = new Point(0, Location.Y);
                }
                if (Location.X + Width >= CMDApplication.BufferSize.Columns)
                {
                    Location = new Point(CMDApplication.BufferSize.Columns - Width - 1, Location.Y);
                }
                if (Location.Y < 0)
                {
                    Location = new Point(Location.X, 0);
                }
                if (Location.Y + Height >= CMDApplication.BufferSize.Rows)
                {
                    Location = new Point(Location.X, CMDApplication.BufferSize.Rows - Height - 1);
                }
                CMDApplication.Refresh();

                dragMove = e.Location;
            }
        }
Ejemplo n.º 2
0
        private void CMDWindow_MouseUp(object sender, MouseEventArgs e)
        {
            dragMove = null;

            if ((e.X == Location.X + Width - 4) && (e.Y == Location.Y))
            {
                CancelEventArgs cancel = new CancelEventArgs(false);
                OnClosing(cancel);
                if (cancel.Cancel)
                {
                    return;
                }

                CMDApplication.Refresh();
                Close();

                OnClosed();
            }
        }