PowerArgs.Cli.Rectangle.IsRightOf C# (CSharp) Method

IsRightOf() public method

public IsRightOf ( Rectangle other ) : bool
other Rectangle
return bool
        public bool IsRightOf(Rectangle other)
        {
            return Right > other.Right;
        }

Usage Example

Example #1
0
        private void FocusChanged()
        {
            bool focusedControlIsWithinMe = VisitControlTree((control) =>
            {
                return(control == Application.FocusManager.FocusedControl);
            });

            if (focusedControlIsWithinMe)
            {
                var offset = Application.FocusManager.FocusedControl.CalculateRelativePosition(this);

                var visibleWindowBounds  = new Rectangle(HorizontalScrollUnits, VerticalScrollUnits, Width, Height);
                var focusedControlBounds = new Rectangle(offset, Application.FocusManager.FocusedControl.Size);

                if (focusedControlBounds.IsAbove(visibleWindowBounds))
                {
                    int amount = visibleWindowBounds.Top - focusedControlBounds.Top;
                    VerticalScrollUnits -= amount;
                }

                if (focusedControlBounds.IsBelow(visibleWindowBounds))
                {
                    int amount = focusedControlBounds.Bottom - visibleWindowBounds.Bottom;
                    VerticalScrollUnits += amount;
                }

                if (focusedControlBounds.IsLeftOf(visibleWindowBounds))
                {
                    int amount = visibleWindowBounds.Left - focusedControlBounds.Left;
                    HorizontalScrollUnits -= amount;
                }

                if (focusedControlBounds.IsRightOf(visibleWindowBounds))
                {
                    int amount = focusedControlBounds.Right - visibleWindowBounds.Right;
                    HorizontalScrollUnits += amount;
                }
            }
        }
All Usage Examples Of PowerArgs.Cli.Rectangle::IsRightOf