B4J Question [SOLVED] Windows screen resolution

jroriz

Active Member
Licensed User
When I change the resolution of my display, using windows config, all open windows (non B4J) automatically adjust their sizes according to the new resolution, except my form created in b4j. I need the form I created also changes its size proportionally to the chosen resolution.
I thought this would happen automatically, no code required.
 

Erel

Administrator
Staff member
Licensed User
Are you changing the resolution or the scale (DPI)? Why would the windows change their sizes when you change the resolution?
 

jroriz

Active Member
Licensed User
Are you changing the resolution or the scale (DPI)? Why would the windows change their sizes when you change the resolution?
You're right.
I bought a 4k monitor, and what is happening is that when I switch to higher resolutions, windows is changing the DPI.
But all windows change their scales, except the forms created in B4J.
I'll try some compatibility modes...
 
Last edited:

Daestrum

Well-Known Member
Licensed User
You could try
B4X:
 #VirtualMachineArgs: -Dsun.java2d.dpiaware=true
in the project attributes region.

Also something else to look at, if I drag a window to my second screen, it stays roughly the same size even though one res is 1600x900, and the other is 3840x2160. The reason - windows added a % scale to the second screen (in display settings). Setting the scale back to 100% for the second screen makes the window shrink as it crosses the screen division.
 
Last edited:

jroriz

Active Member
Licensed User
Are you changing the resolution or the scale (DPI)? Why would the windows change their sizes when you change the resolution?
You're right.
The scale was at 200% ...
I changed it to 100% and everything is right now.
Just in case, I also used the @Daestrum suggestion.
Thank you all.
 
Top