Centering forms 
Author Message
 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  
 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  
 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  
 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  
 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  
 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  
 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  
 Centering forms

Quote:

>Path:
>news.xnet.com!news.sprintlink.net!news.comm.net!imci5!imci4!newsfeed.internetmci
>.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  
 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  
 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  
 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  
 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  
 
 [ 23 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Center Form Over Another Form?

2. Center Form over Form?

3. Center form within MIDI form

4. How to Center Form in Add-In

5. Center form??

6. centering forms

7. Centering forms on the screen

8. TIP: Center Forms to screen

9. Center Forms

10. Auto center form in VB4???

11. How do I center forms...?

12. How do I center forms...?

 

 
Powered by phpBB® Forum Software