Exemplo n.º 1
0
 public void ResetCover()
 {
     if (CoveredControl != null)
     {
         this.Bounds = CoveredControl.RectangleToScreen(CoveredControl.Bounds);
     }
     Invalidate();
 }
Exemplo n.º 2
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
            {
                if (Bounds.IsEmpty || (CoveredControl != null && !CoveredControl.RectangleToScreen(CoveredControl.Bounds).Contains(this.Bounds)))
                {
                    ResetCover();
                }
            }
        }
Exemplo n.º 3
0
 private void AdjustBounds()
 {
     if (CoveredControl != null)
     {
         Rectangle coveredBounds = CoveredControl.RectangleToScreen(CoveredControl.Bounds);
         this.Left     = Math.Max(this.Left, coveredBounds.Left);
         this.Top      = Math.Max(this.Top, coveredBounds.Top);
         this.Width    = Math.Min(this.Right - this.Left, coveredBounds.Right - this.Left);
         this.Height   = Math.Min(this.Bottom - this.Top, coveredBounds.Bottom - this.Top);
         mouseLocation = PointToClient(Cursor.Position);
         Invalidate();
     }
 }