Ejemplo n.º 1
0
        private static void UpdateLocation()
        {
            var rect       = NativeMethods.GetWindowRect(gameHWnd);
            var rectClient = NativeMethods.GetClientRect(gameHWnd);

            var width  = rect.Right - rect.Left; // equal rectClient.Right + shadow*2
            var height = rect.Bottom - rect.Top; // equal rectClient.Bottom + shadow + title

            var winShadow = (width - rectClient.Right) / 2;

            var wholeHeight    = rect.Bottom - rect.Top;
            var winTitleHeight = wholeHeight - rectClient.Bottom - winShadow;

            var clientArea = new Thickness(winShadow, winTitleHeight, winShadow, winShadow);

            GameViewPosChangedEvent?.Invoke(typeof(GameHooker), new GameViewPlacement
            {
                Height     = height,
                Width      = width,
                Left       = rect.Left,
                Top        = rect.Top,
                ClientArea = clientArea
            });

            #region Change FloatButton Position
            if (oldWidth == -1 && oldHeight == -1)
            {
                oldWidth  = width;
                oldHeight = height;
            }
            else if (oldHeight != height || oldWidth != width)
            {
                UpdateButtonPosEvent?.Invoke(typeof(GameHooker), rectClient.Bottom, rectClient.Right);
                oldHeight = height;
                oldWidth  = width;
            }
            #endregion
        }
Ejemplo n.º 2
0
        private static void UpdateLocation()
        {
            var rect       = NativeMethods.GetWindowRect(gameHWnd);
            var rectClient = NativeMethods.GetClientRect(gameHWnd);

            var width  = rect.Right - rect.Left; // equal rectClient.Right + shadow*2
            var height = rect.Bottom - rect.Top; // equal rectClient.Bottom + shadow + title

            var winShadow = (width - rectClient.Right) / 2;

            var wholeHeight    = rect.Bottom - rect.Top;
            var winTitleHeight = wholeHeight - rectClient.Bottom - winShadow;

            var clientArea = new Thickness(winShadow, winTitleHeight, winShadow, winShadow);

            GameViewPosChangedEvent?.Invoke(typeof(GameHooker), new GameViewPlacement
            {
                Height     = height,
                Width      = width,
                Left       = rect.Left,
                Top        = rect.Top,
                ClientArea = clientArea
            });
        }