示例#1
0
        /// <summary>
        /// Repaints cursor on the screen.
        /// </summary>
        ///
        internal void RepaintCursor(Screen screen)
        {
            if (screen == null)
            {
                return;
            }

            // When RepaintCurosr() is called for root window of the screen
            // (having no parent), we need to setup a default cursor (which is an
            // invisible cursor at position ( 0, 0 ).
            //
            if (Parent == null)
            {
                screen.SetCursorPosition(0, 0);
                screen.CursorVisible = false;
            }

            ClipContext clipContext = new ClipContext(screen, Left, Top);

            clipContext.Clip(ClientWidth, ClientHeight);

            if (children.Count > 0)
            {
                ActiveChild.RepaintCursor(screen);
            }
            else
            {
                if (CursorVisible && screen.IsVisible(CursorLeft, CursorTop))
                {
                    screen.SetCursorPosition(
                        screen.Offset.X + CursorLeft, screen.Offset.Y + CursorTop);
                    screen.CursorVisible = true;
                }
            }

            clipContext.Restore();
        }