Need to dynamically re-center a form

R

Robert Morley

Hi everyone,

I have an Access form which I'm dynamically sizing based on the number of
entries in a list box. Simple code to dynamically re-center it doesn't
quite seem to be working as I would expect (AutoCenter is on, then simply
move form up by half the difference of height change). I realize that
algorithm won't be perfect, due to things like title bar height, but I
would've thought it would be close enough. Instead, with large numbers of
entries in the list box, my form goes WAY above the top of the Access "work
area" (i.e., the usable display area after title bars, etc.). I verified
the math, and that seems to be alright, which leads me to believe that
Access' idea of vertically centered...isn't.

As a stop-gap measure, I simply limited the Top to non-negative numbers, but
that doesn't address the actual issue, and looks a little odd besides.

Does anybody have, or know of, any code that will dynamically re-center a
form within Access' work area? I can probably manage to figure it out
myself, possibly resorting to API calls, but it would certainly be a PITA.
I'm sure SOMEBODY must have written code like this before, but my attempts
at googling it didn't turn up anything useful.



Thanks all,
Rob
 
R

Robert Morley

Instead, with large numbers of entries
in the list box, my form goes WAY above the top of the Access "work area"

Re-reading my own note, I realize that may not have been clear...I meant
that not only was it "WAY above", but was not even close to vertically
centered...it needlessly left a significant amount of space below the form
and would have had plenty of room to be vertically centered before exceeding
the bounds of the work area entirely.



Rob
 
J

Jana

Hi everyone,

I have an Access form which I'm dynamically sizing based on the number of
entries in a list box. Simple code to dynamically re-center it doesn't
quite seem to be working as I would expect (AutoCenter is on, then simply
move form up by half the difference of height change). I realize that
algorithm won't be perfect, due to things like title bar height, but I
would've thought it would be close enough. Instead, with large numbers of
entries in the list box, my form goes WAY above the top of the Access "work
area" (i.e., the usable display area after title bars, etc.). I verified
the math, and that seems to be alright, which leads me to believe that
Access' idea of vertically centered...isn't.

As a stop-gap measure, I simply limited the Top to non-negative numbers, but
that doesn't address the actual issue, and looks a little odd besides.

Does anybody have, or know of, any code that will dynamically re-center a
form within Access' work area? I can probably manage to figure it out
myself, possibly resorting to API calls, but it would certainly be a PITA.
I'm sure SOMEBODY must have written code like this before, but my attempts
at googling it didn't turn up anything useful.

Thanks all,
Rob

Rob:

Try the last post in this link:
http://groups.google.com/group/comp...=gst&q=center+a+form&rnum=13#c847d8e8b866dcd9

HTH
Jana
 
R

Robert Morley

Thanks, but that's not quite what's happening. This form is opened
normally, and is always a child of the Access window.


Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top