Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An Interface that sizes/is compatable to various size monitors

Status
Not open for further replies.

rabbithole

Programmer
May 5, 2000
8
AU
I am a new VB programmer.<br><br>Just looking for some good insight into how to create screens that size themselves to the particular monitor being used. Any reference to books that might be useful would be appreciated.Websites also. Plus personal insights and understanding - hints. The more info the better.<br><br><br>Your help is greatly appreciated.<br>
 
There are a couple of OCXs that do this (VSFlex is one).&nbsp;&nbsp;But if you want to do this yourself, the general technique is:<br><br>1) Pick controls which will follow the edges of the form.&nbsp;&nbsp;Typically, such would be the OK, Cancel buttons, a textfield, whatever.&nbsp;&nbsp;These will stay the same dimensions no matter what.<br><br>2) Identify controls in the middle of the form which can be resized.&nbsp;&nbsp;Good candidates are grids, listboxes, comboboxes (sometimes), and multi-line textboxes.<br><br>3) Determine the absolute minimum size of the form (it's best to do your designing at this size), and put code in the form_resize event to prevent the form from becoming smaller than this.<br><FONT FACE=monospace>&nbsp;&nbsp;&nbsp;&nbsp;Form_Resize()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Me.Windowstate = vbMinimized then Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Me.Width &lt; MyMinimumWidth Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me.Width = MyMinimumWidth<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Me.Height &lt; MyMinimumHeight Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me.Height = MyMinimumHeight<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br></font><br><br>4) After this code, put code in to move the non-sizable controls to their proper position.&nbsp;&nbsp;Then put code in to move and resize the resizable controls to their position.<br><br>Hope this helps.<br>Chip H.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top