예제 #1
0
            /// <summary>
            /// Cross-platform handy method to get the size of the screen
            /// </summary>
            /// <returns>SIZE measures of the screen of primary monitor</returns>
            public SciterSize GetPrimaryScreenSize()
            {
                var screenWidth  = PInvokeGtk.gdk_screen_width();
                var screenHeight = PInvokeGtk.gdk_screen_height();

                return(new SciterSize(screenWidth, screenHeight));
            }
예제 #2
0
            /*
             #if WINDOWS || NETCORE
             * public bool ModifyStyle(PInvokeWindows.WindowStyles dwRemove, PInvokeWindows.WindowStyles dwAdd)
             * {
             *      int GWL_EXSTYLE = -20;
             *
             *      PInvokeWindows.WindowStyles dwStyle =
             *              (PInvokeWindows.WindowStyles) PInvokeWindows.GetWindowLongPtr(Handle, GWL_EXSTYLE);
             *      PInvokeWindows.WindowStyles dwNewStyle = (dwStyle & ~dwRemove) | dwAdd;
             *
             *      if (dwStyle == dwNewStyle)
             *              return false;
             *
             *      PInvokeWindows.SetWindowLongPtr(Handle, GWL_EXSTYLE, (IntPtr) dwNewStyle);
             *      return true;
             * }
             *
             * public bool ModifyStyleEx(PInvokeWindows.WindowStyles dwRemove, PInvokeWindows.WindowStyles dwAdd)
             * {
             *      int GWL_STYLE = -16;
             *
             *      PInvokeWindows.WindowStyles dwStyle =
             *              (PInvokeWindows.WindowStyles) PInvokeWindows.GetWindowLongPtr(Handle, GWL_STYLE);
             *      PInvokeWindows.WindowStyles dwNewStyle = (dwStyle & ~dwRemove) | dwAdd;
             *      if (dwStyle == dwNewStyle)
             *              return false;
             *
             *      PInvokeWindows.SetWindowLongPtr(Handle, GWL_STYLE, (IntPtr) dwNewStyle);
             *      return true;
             * }
             #endif*/

            /// <summary>
            /// Centers the window in the screen. You must call it after the window is created, but before it is shown to avoid flickering
            /// </summary>
            public void CenterWindow(IntPtr window)
            {
                var screenWidth  = PInvokeGtk.gdk_screen_width();
                var screenHeight = PInvokeGtk.gdk_screen_height();

                PInvokeGtk.gtk_window_get_size(window, out var windowWidth, out var windowHeight);

                var newX = (screenWidth - windowWidth) / 2;
                var newY = (screenHeight - windowHeight) / 2;

                PInvokeGtk.gtk_window_move(window, newX, newY);
            }