using System; using System.Drawing; // The 'windowHandle' parameter will contain the window handle for the: // - Active window when run by hotkey // - Window Location target when run by a Window Location rule // - TitleBar Button owner when run by a TitleBar Button // - Jump List owner when run from a Taskbar Jump List // - Currently focused window if none of these match public static class DisplayFusionFunction { public static void Run(IntPtr windowHandle) { //get the width from the user string widthPercent = BFS.Dialog.GetUserInput("The width of the window in percent:", ""); //if the user entered nothing or pressed cancel, if(string.IsNullOrEmpty(widthPercent)) return; string heightPercent = BFS.Dialog.GetUserInput("The height of the window in percent:", ""); if(string.IsNullOrEmpty(heightPercent)) return; Rectangle monitorWorkArea = BFS.Monitor.GetMonitorWorkAreaByWindow(windowHandle); try { BFS.Window.SetSize(windowHandle, (int)(monitorWorkArea.Width * (Convert.ToInt32(widthPercent) / 100m)), (int)(monitorWorkArea.Height * (Convert.ToInt32(heightPercent) / 100m))); } catch { } } }