Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Brynwall's profile on WallpaperFusion.com
I have a Custom function to move Window to the Center and enlarge, but I was hoping to have a function that does the same thing, but have the start position 1/3rd from the left of the screen and enlarge to the right (I have an ultrawide monitor).

Is it possible to start at a percentage of the screen? The Alignment options seem somewhat limted and none of them would work the way I'm trying to get it to work.

I was using the Beta, but was having to many issues with these functions so I went back to standard.
2024-03-25 13_03_11-Settings _ DisplayFusion Pro on Steam 10.1.2.png
2024-03-25 13_03_11-Settings _ DisplayFusion Pro on Steam 10.1.2.png
Mar 25, 2024  • #1
Brynwall's profile on WallpaperFusion.com
options for alignment
2024-03-25 13_04_51-Edit Function _ DisplayFusion Pro on Steam 10.1.2.png
2024-03-25 13_04_51-Edit Function _ DisplayFusion Pro on Steam 10.1.2.png
Mar 25, 2024  • #2
User Image
JLJTGR
104 discussion posts
Use this as a C# scripted function:

Code

using System;
using System.Drawing;
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        Rectangle monitorRect = BFS.Monitor.GetMonitorBoundsByWindow(windowHandle);
        BFS.Window.SetSizeAndLocation(windowHandle, (int)(monitorRect.Width * 0.33), 0, monitorRect.Width - (int)(monitorRect.Width * 0.33), monitorRect.Height);
    }
}


If you want to adjust the percentage, replace the two
0.33
with a different number instead of 33%.
Mar 26, 2024  • #3
Brynwall's profile on WallpaperFusion.com
This looks like it just sizes the windows to 33% and doesn't place it in the 33% of the monitor. Am I reading that wrong?

I've already got 3 functions that split it to the left 1/3rd, the middle 1/3rd, and the right 1/3rd, but I'm wanting the left side of the window to START in the middle left 3rd and extend right instead of starting in the middle of the screen and extending left AND right.

Quote:
Use this as a C# scripted function:

Code

using System;
using System.Drawing;
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        Rectangle monitorRect = BFS.Monitor.GetMonitorBoundsByWindow(windowHandle);
        BFS.Window.SetSizeAndLocation(windowHandle, (int)(monitorRect.Width * 0.33), 0, monitorRect.Width - (int)(monitorRect.Width * 0.33), monitorRect.Height);
    }
}


If you want to adjust the percentage, replace the two
0.33
with a different number instead of 33%.
Mar 26, 2024 (modified Mar 26, 2024)  • #4
User Image
JLJTGR
104 discussion posts
Why don't you try it and see if it does what you want? It does what I was able to understand of your request. The function literally says it affects size and location. It uses
0.33
two times... once for left position and once to resize the window to be that much smaller than the entire screen.

Maybe draw a picture?
Mar 26, 2024 (modified Mar 26, 2024)  • #5
User Image
JLJTGR
104 discussion posts
It just occurred to me that this might not work perfectly for everyone. I have my taskbar autohide, so I didn't care about the space that the taskbar occupies. (it occupies zero) For most people, their taskbar does occupy space... so please replace
GetMonitorBoundsByWindow
with
GetMonitorWorkAreaByWindow
.
Mar 26, 2024  • #6
Brynwall's profile on WallpaperFusion.com
Ah! I didn't understand the code initially. Thank you! That Worked! These are the parameters that I used:

Code

using System;
using System.Drawing;
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        Rectangle monitorRect = BFS.Monitor.GetMonitorBoundsByWindow(windowHandle);
        BFS.Window.SetSizeAndLocation(windowHandle, (int)(monitorRect.Width * 0.3333), 0, monitorRect.Width - (int)(monitorRect.Width * 0.55), monitorRect.Height);
    }
}
Mar 27, 2024  • #7
Brynwall's profile on WallpaperFusion.com
How do I get it to work on the CURRENT window and not go to a specific one?
Apr 25, 2024  • #8
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Are you using the code from your last post? It should be setting the size of whatever window is currently focused
Apr 29, 2024  • #9
Brynwall's profile on WallpaperFusion.com
I am using the same code. It constantly puts it on monitor #2 no matter which monitor I have the window on.
Apr 29, 2024  • #10
User Image
JLJTGR
104 discussion posts
I edited this to offset the origin coordinates by the detected monitor's top/left corner instead of assuming it started at 0,0. Also includes the edit to use the working area instead of the full area. (Won't work correctly if you have a top or left aligned taskbar)

Code

using System;
using System.Drawing;
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        Rectangle monitorRect = BFS.Monitor.GetMonitorWorkAreaByWindow(windowHandle);
        BFS.Window.SetSizeAndLocation(windowHandle, 
            monitorRect.Left + (int)(monitorRect.Width * 0.3333), monitorRect.Top, 
            monitorRect.Width - (int)(monitorRect.Width * 0.3333), monitorRect.Height);
    }
}

I didn't really understand why you changed one of the numbers to
0.55
. Is there another requirement that you didn't specify before?
Apr 29, 2024  • #11
Brynwall's profile on WallpaperFusion.com
Thank you!!! That worked!
This helps a ton when I'm trying to show clients a bigger window.
Apr 30, 2024 (modified Apr 30, 2024)  • #12
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(1)  Login to Vote(-)