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)
{
//check to see if there was an error, if there was, exit function
if (windowHandle == IntPtr.Zero)
return;
//get the position of the window in the monitor, and the current monitor
Rectangle windowRect = BFS.Window.GetBounds(windowHandle);
Rectangle monitorRect = BFS.Monitor.GetMonitorWorkAreaByWindow(windowHandle);
int iFinalWinX = monitorRect.X;
int iFinalWinY = monitorRect.Y;
int iFinalWinW = monitorRect.Width / 3;
int iFinalWinH = monitorRect.Height;
if( windowRect.X == iFinalWinX
/* && windowRect.Y == iFinalWinY
&& windowRect.Width == iFinalWinW
&& windowRect.Height == iFinalWinH ) {
iFinalWinX = monitorRect.X + iFinalWinW;
} else if (windowRect.X == iFinalWinX + iFinalWinW) */
{ iFinalWinX = monitorRect.X + 2*iFinalWinW;
} else if (windowRect.X == iFinalWinX + 2*iFinalWinW) {
iFinalWinX = monitorRect.X;
}
BFS.Window.SetSizeAndLocation(windowHandle, iFinalWinX, iFinalWinY, iFinalWinW, iFinalWinH );
}
}using System;
using System.Drawing;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
// Set the window width percentage here
double windowWidthPercent = 0.33;
// Get the monitor bounds
Rectangle monitorBounds = BFS.Monitor.GetMonitorBoundsByWindow(windowHandle);
// Create the target window bounds
Rectangle targetWindowBounds = new Rectangle();
// Set the target window width to the screen width * the windowWidthPercent
targetWindowBounds.Width = Convert.ToInt32(monitorBounds.Width * windowWidthPercent);
// Set the target window height to 100% of the screen height
targetWindowBounds.Height = monitorBounds.Height;
// Set the target X value to monitor X + monitor width - window width
targetWindowBounds.X = (monitorBounds.X + monitorBounds.Width) - targetWindowBounds.Width;
// Set the target Y value to the top of the monitor
targetWindowBounds.Y = monitorBounds.Y;
// Resize and move the window
BFS.Window.SetSizeAndLocation(windowHandle, targetWindowBounds.X, targetWindowBounds.Y, targetWindowBounds.Width, targetWindowBounds.Height);
}
}