ATMLWorkBench.Forms.SignalComponent.maintainBounds C# (CSharp) Method

maintainBounds() private method

private maintainBounds ( ) : void
return void
        private void maintainBounds()
        {
            Rectangle r = new Rectangle(location.X, location.Y, width, height);
            if( !bounds.Contains(r) )
            {
                if( location.X <= container.ClientRectangle.Left )
                    location.X = container.ClientRectangle.Left;
                if( location.Y <= container.ClientRectangle.Top )
                    location.Y = container.ClientRectangle.Top;
                if( location.X + Width >= container.ClientRectangle.Width )
                    location.X = container.ClientRectangle.Width - Width;
                if( location.Y + Height >= container.ClientRectangle.Height )
                    location.Y = container.ClientRectangle.Height - Height;
            }
        }