Topic: Scalable Form sizes
Hi All,
Back in October I asked about making my forms resize themselves to fit various computer screens. I received quite a bit of feedback but was never able to make anything work for me.
-
Here's where I am today (Dec 2020):
I have 2 computers as follows:
My development laptop PC(1) - 1920 x 1080, scale 150%, Landscape
My 2nd older PC(2) - 1366 x 768, scale 125%, Landscape
-
When I designed my forms to fit nicely on PC1 everything looks good.
However when I move my program to PC2 the forms are too big and parts of the forms go beyond the screen making the application unusable.
-
So I sized my forms to 1075 x 480 so they will work on PC2. They also work on PC1 but they don't fill up the screen. And I assume on a bigger monitor that the forms will be the same size, however not taking advantage of the bigger screen size. Note: when I hit Maximize it does fill the screen but the form(s) remain the same size and do not scale.
-
I also noticed today that when my program is on PC2, the table grids do not show all of my entries. It does show a horizontal scroll bar that will let me scroll right and read all the entries. However there are no scroll bars on PC1 and that's OK as everything shows up as I originally designed them.
-
In October I received a reply from CDB as follows:
I have read that the Delphi 'scale by' function works better if percentage scaling is used.
You could try - finding the users screen size as shown in the code snippets above and then using the scale by function increase or decrease the form size. Using your screen resolution as the default screen size.
So you would create two constants that hold your screen size - defaultScreenWidth and defaultScreenHeight and then use those to find the difference as presented by - screen.width and screen.height (these will always be the users screen size figures). From the result you can use the percentage figure ScaleBy(Screen.Width,percentage).
-
This sounds like it might work but I can't figure out how to implement it. I'm not sure how or where to use the ScaleBy function.
-
Since a program could potentially be used on a smaller laptop all the way to a fullsize desktop monitor, I'm wondering how folks implement scaling for MVD programs?
-
Any thoughts will be appreciated.
Thanks
Frank (I forgot to mention that I'm a novice when it comes to scripting...but I'm learning)