Re: centering a form

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 07/12/04


Date: Sun, 11 Jul 2004 22:19:41 -0400

I have too, on one machine, and usually with msgboxes. It's almost as if
something has told windows the screen is larger than it is, such as when
using a virtual desktop greater than the maximum screen resolution.

-- 
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Jezebel" <dwarves@heaven.com.kr> wrote in message 
news:OYZGae5ZEHA.3708@TK2MSFTNGP10.phx.gbl...
: Yes Randy, I understood that from the comments to the code you posted. But
: the original poster's problem is that these coordinates (whether as one 
move
: or two) are not in fact putting his form in the middle of the screen. I've
: seen this problem also.
:
:
: "Randy Birch" <rgb_removethis@mvps.org> wrote in message
: news:OzhN7E2ZEHA.3596@tk2msftngp13.phx.gbl...
: > On some systems the form can be seen to change first its left, then top
: > placement when the individual properties are set. Move eliminates the
: > dual-move.
: >
: > -- 
: >
: > Randy Birch
: > MVP Visual Basic
: > http://vbnet.mvps.org/
: > Please respond only to the newsgroups so all can benefit.
: >
: >
: > "Jezebel" <dwarves@heaven.com.kr> wrote in message
: > news:OAwRRExZEHA.1356@TK2MSFTNGP09.phx.gbl...
: > : This method might be better from a performance point of view, but it's
: > using
: > : the same co-ordinates, so the end result will surely be the same? And 
if
: > the
: > : original doesn't actually put the form in the middle ....?
: > :
: > :
: > :
: > : "Randy Birch" <rgb_removethis@mvps.org> wrote in message
: > : news:efkuuUvZEHA.3480@TK2MSFTNGP11.phx.gbl...
: > : > Use the Move method, not the left and top properties ...
: > : >
: > : > http://vbnet.mvps.org/code/faq/centreform.htm
: > : > http://vbnet.mvps.org/code/faq/centreparent.htm
: > : >
: > : >
: > : > -- 
: > : >
: > : > Randy Birch
: > : > MVP Visual Basic
: > : > http://vbnet.mvps.org/
: > : > Please respond only to the newsgroups so all can benefit.
: > : >
: > : >
: > : > "Scott Baxter" <sbaxter@websearchstore.com> wrote in message
: > : > news:#9WRDcuZEHA.3228@TK2MSFTNGP12.phx.gbl...
: > : > : I have been trying to center a form on Windows 2000 using the
: > following
: > : > : subroutine:
: > : > :
: > : > : Public Sub center(Anyform As Form)
: > : > : Anyform.left = (Screen.Width - Anyform.Width) / 2
: > : > : Anyform.tOp = (Screen.Height - Anyform.Height) / 2
: > : > : DoEvents
: > : > : End Sub
: > : > :
: > : > : However, the form ends up on the lower right of the computer when
: > : > : autostarted during windows startup.
: > : > :
: > : > : If I run it in development mode, it works perfectly.
: > : > :
: > : > : In startup mode the screen.height and width seem totally wrong.
: > : > :
: > : > : What is the answer?  Any help would be great.
: > : > :
: > : > : Scott Baxter
: > : > :
: > : > :
: > : >
: > :
: > :
: >
:
: 


Relevant Pages

  • Re: Adding an item to R-Click context menu
    ... Windows Script 5.6 for Windows 98, Windows Millennium Edition, and Windows ... "Randy Birch" wrote in message ... >: LuckyStrike ... >:> Please respond only to the newsgroups so all can benefit. ...
    (microsoft.public.vb.general.discussion)
  • Re: centering a form
    ... I have too, on one machine, and usually with msgboxes. ... something has told windows the screen is larger than it is, ... :> Randy Birch ... :> Please respond only to the newsgroups so all can benefit. ...
    (microsoft.public.vb.general.discussion)
  • Re: Monitoring File System Changes
    ... Randy Birch ... Please respond only to the newsgroups so all can benefit. ... "Steve" wrote in message ... Is there any to hook my VB app into Windows so that Windows will trigger ...
    (microsoft.public.vb.general.discussion)
  • Re: Check the processor speed
    ... it's not on earlier Windows versions. ... :> Randy Birch ... :> Please respond only to the newsgroups so all can benefit. ... :>: Shmuel ...
    (microsoft.public.vb.winapi)
  • Re: Reading File Information (author, company, copyright)
    ... Please respond only to the newsgroups so all can benefit. ... "Jim Carlock" wrote in message ... : "Randy Birch" wrote: ... :: SP6 presents an error during the install but overwrites the file. ...
    (microsoft.public.vb.general.discussion)