Login / Register
▼
Binary Fortress
Binary Fortress Software
ASP.NET ViewState Helper
CheckCentral
ClipboardFusion
CloudShow
DisplayFusion
FileSeek
HashTools
iTunesFusion
JigsawMania
LogFusion
Notepad Replacer
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
VoiceBot
WallpaperFusion
Home
▼
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
▼
Features
Features
Incredible Desktop Wallpaper
Precise Monitor Controls
Powerful Functions
Triggers
Multi-Monitor Taskbars
Useful Windows 10 Tweaks
Useful Windows 8 Tweaks
Windows Lock Screen
Multi-Monitor Screen Savers
Monitor Fading
Window Snapping
Window Management
Mouse Management
Alt+Tab Handler
Window Position Profiles
Desktop Icon Profiles
Remote Control
Available in dozens of Languages
Easy Administration
Free vs Pro
Purchase
Screenshots
Languages
▼
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Scripted Functions (Macros)
DisplayFusion
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Scale Window Size Up/Down
Return to DisplayFusion Scripted Functions (Macros)
Description
This function quickly increases or decreases the size of the focused window. The amount by which the window is resized is configurable, and the window is automatically constrained (smallest size is user configurable, biggest size is the monitor's dimensions) before being resized.
Language
C#
Minimum Version
9.0.0+
Created By
Ryan Thaut
Contributors
-
Date Created
Oct 25, 2017
Date Last Modified
Oct 25, 2017
Scripted Function (Macro) Code
Copy
Select All
Toggle Line Wrapping
using System; using System.Drawing; using System.Collections.Generic; // 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) { // set the scale amount // (greater than 1.0 increases window size, less than 1.0 decreases window size) float scaleAmount = 0.9f; // set the minimum size for the window (relative to the monitor's size) float minimumRelativeSize = 0.2f; /* === DO NOT MODIFY BELOW THIS LINE === */ Rectangle rWindow = BFS.Window.GetBounds(windowHandle); Rectangle rMonitor = BFS.Monitor.GetMonitorWorkAreaByWindow(windowHandle); int iWinW = (int)(rWindow.Width * scaleAmount); int iWinH = (int)(rWindow.Height * scaleAmount); int iWinX = rWindow.Left - (int)((iWinW - rWindow.Width) / 2.0f); int iWinY = rWindow.Top - (int)((iWinH - rWindow.Height) / 2.0f); // constrain the window to the monitor's bounds if (iWinW > rMonitor.Width || iWinX < rMonitor.Left || (iWinX + iWinW) > rMonitor.Right) { iWinW = rWindow.Width; iWinX = rWindow.Left; } if (iWinH > rMonitor.Height || iWinY < rMonitor.Top || (iWinY + iWinH) > rMonitor.Bottom) { iWinH = rWindow.Height; iWinY = rWindow.Top; } // enforce the minimum size constraint if (iWinW < (int)(rMonitor.Width * minimumRelativeSize)) { iWinW = rWindow.Width; iWinX = rWindow.Left; } if (iWinH < (int)(rMonitor.Height * minimumRelativeSize)) { iWinH = rWindow.Height; iWinY = rWindow.Top; } BFS.Window.SetSizeAndLocation(windowHandle, iWinX, iWinY, iWinW, iWinH); } }
Copyright © 2007-2019 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get DisplayFusion Merch