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?

User Image
johnb2233
49 discussion posts
Hi,

In a trigger I would like to move a window to the top right corner of the screen and then make it 'always on top'.

How can I do the move to top right corner (no resizing) in a script.

I can see how to make the window 'always on top'.

Many thanks,
John
johnb2233
May 23, 2017  • #1
PabloMartinez's profile on WallpaperFusion.com
Hi. Here's a simple solution. :)

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        var wBounds = BFS.Window.GetBounds(windowHandle);
        /// For primary monitor
        var wArea = BFS.Monitor.GetPrimaryMonitorWorkArea();

        /// Uncomment the following lines that you need.

        /// Top Left

        //BFS.Window.SetLocation(windowHandle, wArea.Left, wArea.Top);
        
        /// Top Right

        //BFS.Window.SetLocation(windowHandle, wArea.Right - wBounds.Width, wArea.Top);
        
        /// Bottom Left

        //BFS.Window.SetLocation(windowHandle, wArea.Left, wArea.Bottom - wBounds.Height);

        /// Bottom Right

        //BFS.Window.SetLocation(windowHandle, wArea.Right - wBounds.Width, wArea.Bottom - wBounds.Height);

        /// "Always on top"

        BFS.Window.SetAlwaysOnTop(windowHandle, true);
    }
}
May 23, 2017 (modified May 23, 2017)  • #2
User Image
johnb2233
49 discussion posts
Hi PabloMartinez,

Many thanks for your response, it is much appreciated and it works...

Again thanks,
John
johnb2233
May 24, 2017  • #3
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)