AutoCenter Property

M

Marshall Barton

a said:
Autocenter center the form in middle of my screen between left and right
only
I want to center the form in the middle of my screen top and bottom also.
I will tell you an example :
Msgbox
display in center of screen righ and lift top and bottom


Have you tried using the form's AutoCenter property? If you
did, what happend to make you think it was not centered in
the Access window?
 
L

Linq Adams via AccessMonster.com

The OP's post would suggest that he has tried AutoCenter! But it behaves just
as he stated: it centers the form HORIZONTALLY ONLY, it does not center a
form vertically! Another of Access' lovely quirks!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
D

Dirk Goldgar

a said:
Autocenter center the form in middle of my screen between left and right
only
I want to center the form in the middle of my screen top and bottom also.
I will tell you an example :
Msgbox
display in center of screen righ and lift top and bottom
Thank you


I don't know why Access's idea of "centered" isn't quite centered
vertically. But you can use Nicole Calinoiu's FormWindow calss, posted
here:

http://www.mvps.org/access/forms/frm0042.htm
Forms: Move and Resize form windows from code

.... to center the form more accurately. With that class imported into your
project, you can center the current form using code like this:


Dim FW As New clFormWindow

FW.hwnd = Me.hwnd
With FW
.top = (.Parent.Height - .Height) / 2
.Left = (.Parent.Width - .Width) / 2
End With
Set FW = Nothing
 
D

Dirk Goldgar

a said:
Thank you for your help and reply
but i find error when compliling the data base:
User-defined type not defined
Public Property Get Parent() As clFormWindow


Did you import the class module as "clFormWindow"? Did you import it as a
class module, not a standard module?
 
A

a

Autocenter center the form in middle of my screen between left and right
only
I want to center the form in the middle of my screen top and bottom also.
I will tell you an example :
Msgbox
display in center of screen righ and lift top and bottom
Thank you
 
D

Dirk Goldgar

a said:
I do what you say:
Class Module
Name: clFormWindow
I get the error also


It works for me. Try this:

1. Save the file from the webside on your disk.

2. Open the file in Notepad.

3. Open your Access project.

4. In the VB Editor, choose menu items Insert -> Class Module.

5. Delete the "Option Compare Database" and "Option Explicit" lines that
were probably inserted in the new class module automatically.

6. Copy and paste the complete code from the NotePad window to the module
window.

7. Save the module, assigning it the name "clFormWindow".

8. Compile.
 
A

a

Thank you for your help and reply
but i find error when compliling the data base:
User-defined type not defined
Public Property Get Parent() As clFormWindow

Thank you
 

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