Author |
Message |
SCHANKE, ARIL #1 / 23
|
 Centering forms
Does anyone have any command-lines that would center the forms on the screen (in run-time) regardless of resolution/monitor. If I change the resolution (work on another machine), the forms appear out of place, and I have to adjust them. - Arild
|
Mon, 20 Jul 1998 03:00:00 GMT |
|
 |
Andrew Retallac #2 / 23
|
 Centering forms
Quote:
> Does anyone have any command-lines that would center the forms on > the screen (in run-time) regardless of resolution/monitor.
On the form_load event, use the following: Form1.Left = Int( (Screen.Width - Form1.Width) / 2) Form1.Top = Int( (Screen.Height - Form1.Height) / 2) G'Luck ------------------------------------------------------------ Andrew Retallack - Johannesburg, South Africa
"The views expressed above are figments of your imagination"
|
Mon, 20 Jul 1998 03:00:00 GMT |
|
 |
Jens Balchen J #3 / 23
|
 Centering forms
to share with us the infinite reservoirs of wisdom: Quote: >Does anyone have any command-lines that would center the forms on >the screen (in run-time) regardless of resolution/monitor.
Sub Form_Load () Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 End Sub Jens -- Everything I said are the opinions of someone else. I just cut-and-pasted. Jens Balchen jr. http://www.sn.no/~balchen
|
Mon, 20 Jul 1998 03:00:00 GMT |
|
 |
Reggie Brook #4 / 23
|
 Centering forms
Quote: >Does anyone have any command-lines that would center the forms on >the screen (in run-time) regardless of resolution/monitor. >If I change the resolution (work on another machine), the forms >appear out of place, and I have to adjust them. >- Arild
In the Form_Load() procedure for the form, add the following line: Move (Screen.Width - Width) \ 2, Screen.Height - Height) \ 2 This will center the form on the screen when the form loads.
|
Tue, 21 Jul 1998 03:00:00 GMT |
|
 |
Myakl #5 / 23
|
 Centering forms
writes: Quote: >>Does anyone have any command-lines that would center the forms on >>the screen (in run-time) regardless of resolution/monitor. >Sub Form_Load () > Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 >End Sub
I am curious why you favor the Move Method over setting the Top/Left props.....
|
Tue, 21 Jul 1998 03:00:00 GMT |
|
 |
Harry Stryb #6 / 23
|
 Centering forms
Quote: >Subject: Centering forms
>Date: 1 Feb 96 11:45:01 MET >Does anyone have any command-lines that would center the forms on >the screen (in run-time) regardless of resolution/monitor. >If I change the resolution (work on another machine), the forms >appear out of place, and I have to adjust them. >- Arild
Sub CenterForm (f As Form) f.Left = (Screen.Width - f.Width) / 2 f.Top = (Screen.Height - f.Height) / 2 End Sub then as you load a form in load event put: CenterForm Me
|
Wed, 22 Jul 1998 03:00:00 GMT |
|
 |
m #7 / 23
|
 Centering forms
Quote:
>> Does anyone have any command-lines that would center the forms on >> the screen (in run-time) regardless of resolution/monitor.
Try looking in the SETUP program MS so kindly gave you source for. It tells you alot if you look, including centering forms..
|
Thu, 23 Jul 1998 03:00:00 GMT |
|
 |
Peter Mikalajun #8 / 23
|
 Centering forms
Quote:
>Path: >news.xnet.com!news.sprintlink.net!news.comm.net!imci5!imci4!newsfeed.inter netmci >.com!vixen.cso.uiuc.edu!howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!n >ews.NetVision.net.il!news
>Newsgroups: comp.lang.basic.visual.misc >Subject: Re: Centering forms >Date: Sun, 04 Feb 1996 18:53:57 GMT >Organization: thiers >Lines: 8
>Reply-To: me >NNTP-Posting-Host: ts3jp7.netvision.net.il >X-Newsreader: Forte Free Agent v0.55
>>> Does anyone have any command-lines that would center the forms on >>> the screen (in run-time) regardless of resolution/monitor. >Try looking in the SETUP program MS so kindly gave you source for. It >tells you alot if you look, including centering forms..
Me.Move(screen.Width - Me.Width)\2, (screen.Height - Me.Height)\2 Peter Mikalajunas
http://www.xnet.com/~kd9fb
|
Thu, 23 Jul 1998 03:00:00 GMT |
|
 |
Mark Payto #9 / 23
|
 Centering forms
Quote:
> Does anyone have any command-lines that would center the forms on > the screen (in run-time) regardless of resolution/monitor. > If I change the resolution (work on another machine), the forms > appear out of place, and I have to adjust them.
This works for me, Arild. Sub centerform (F As Form) ' Center the specified form within the screen F.Move ((Screen.Width - F.Width) \ 2), ((Screen.Height - F.Height) \ 2) End Sub Mark Payton Custom Crafted Systems, Inc.
|
Fri, 24 Jul 1998 03:00:00 GMT |
|
 |
Andrew Thoma #10 / 23
|
 Centering forms
Hi I am new to this news group and VB3 in general. Forgive me if this question has all ready been asked. Is there a method of disabling the ATL-TAB key stroke, to stop windows from swiching to another active program or window. from within a active VB program. Any constructive comments welcome.. Andy :-) Time is but a small tear on the fabric of the universe.
|
Sat, 25 Jul 1998 03:00:00 GMT |
|
 |
Hans van Veen - ITT Gouden Gi #11 / 23
|
 Centering forms
Quote:
>>> Does anyone have any command-lines that would center the forms on >>> the screen (in run-time) regardless of resolution/monitor. > Try looking in the SETUP program MS so kindly gave you source for. It > tells you alot if you look, including centering forms..
Me.Top = (Screen.Height - Me.Height)/2 Me.Left = (Screen.Width - Me.Width)/2 Cheers, Hans
ITT Gouden Gids IS/OS CServe : 100145,2744 Hoekenrode 1 Phone : +31 20 5676797 1102 BR AMSTERDAM, Netherlands Fax : +31 20 6911948
|
Sun, 26 Jul 1998 03:00:00 GMT |
|
 |
Ketil Kru #12 / 23
|
 Centering forms
Quote: >Sub centerform (F As Form) >' Center the specified form within the screen > F.Move ((Screen.Width - F.Width) \ 2), ((Screen.Height - F.Height) \ 2) >End Sub
- and if you divide the height by 3 instead (leaving one third of free space at the top and two thirds at the bottom), you'll get a more pleasing position - let's call it a more "visual" center.
|
Sun, 26 Jul 1998 03:00:00 GMT |
|
|