n00b question - form not same size on diff. screen resolutions

r_kabouter
03-24-2003, 06:58 PM
/me new to forums

I start off by making a new form...maximize...put a command button on upper-left-most corner...another on the lower-right-most corner...make .exe

It looked fine on 1024x768, but when I reduced the resolution to 800x600 the button became huge, and the lower-right button was not there. How do I make the form the same size for all resolutions, or, how do I make scrollbars for the form instead? VB does not make one automatically. Actually, maybe the scrollbars idea sounds better, but I don't know how to use them. Please help...

A-Dam
03-24-2003, 09:35 PM
Hey, that's not a bad nooby question. Changes in screen resolution is a pain in VB, and also when users have large fonts in their settings. If you used scroll bars, the form would still open with the button off-screen and the user would have to scroll to see it. Not my idea of good UI design. If you only have a few controls on the form, you can use code like this below to control the size and location of the form and controls.

Private Sub Form_Load()
Me.Move 0, 0, Screen.Width, Screen.Height
Command1.Move Screen.Width / 10, Screen.Height / 10, Me.Width / 20, Me.Height / 20
'etc.

End Sub

Basically all dimensions are relative to screen size. I have noticed that VB often gives incorrect screen dimensions after you change resolution in control panel. This may only be while the project is running in the IDE because it was correct again when I closed VB and ran the project again.

Good luck with that

r_kabouter
03-25-2003, 02:59 AM
So you say that the only way to fix up the screen is to move and resize the stuff inside the form? Is there a more effiecient way of doing that? That means that if I have plenty of stuff inside, then I will have to move and resize each of them?

Machaira
03-25-2003, 07:04 AM
There are components that will automatically scale the size of the controls on a form when you resize the form. However, ou should design your forms to fit in the lowest resolution a user will have. If it's 800x600, then design the form to fit that screen and either don't worry about a higher resolution or move the controls for the higher resolution, not the other way around. Personally I wouldn't worry about people running it at a higher resolution. Also, I wouldn't recommend designing forms that are normally maximized, unless it's an MDI form where most of the controls on it (toolbar, status bar, etc) scale automatically anyway. You avoid the resolution problem that way.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum