Click here to Skip to main content
15,894,720 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using VS 2019 with VB. I have, for a long time, tried to come up with a method to insure my form and controls will adjust correctly with different screen resolutions and video card differences. I read, at one time it had to do with twips. There has to be a method/ class/ function that can handle this. I have tried, in vain, to make this happen but it always fails some way. I would love, for once, to have an image that is 300px X 400px to be the same on all monitors, etc. Any assistance is greatly appriciated

What I have tried:

I have tried converting to twips
Posted
Updated 13-Apr-20 22:25pm

There is no standard way to do this: automatic resizing of controls / forms doesn't work well because none of it is designed to do that - WPF is, but the learning curve there is a brick-wall ...

Think about it: it's really easy to make a button grow and shrink as a form does - just setting the anchor property to top, left, bottom, right will do that. But ... the font that the button text is written in won't change unless you specifically work out that it's now too big or too small and work out the right font size to use for that specific control.
And the button next to it has different text, so the font size that needs won't necessarily be the same. And then the two buttons look weird next to each other ...

Forms aren't designed for this, and it's not a simple thing to do at all - and getting it to look right is even harder, if it's even possible.

Look at MS and how they handle it: they don't grow and shrink controls at all - then have a central "work area" and dockable tool areas around the outside of that. Did you think that was just "how it happened"? :laugh:
 
Share this answer
 
I don't agree complete with the Solution of Griff - (sorry Griff)
Within Forms you could do that - but of cause it's not so easy.
The 1st is the Screen-Ratio - do you have a soultion to handle either 4:3 or 16:9 for senseful resize the Controls on the Form ?
If Yes :
- resize and relocate all controls
- I have a method which could calculate the maximum FontSize for each Control. So you could iterate through the ControlsCollectiopn of the Form to get the lowest MaximumFontSize.
- now you iterate through the ControlsCollection and set this FontSize to each Control

If you are interested I would provide this code for you ... (or you look here : https://www.codeproject.com/Answers/5262823/Auto-resize-font-in-a-given-box-visualbasic#answer1 )
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900