Customising the form size

I

Imran Ghani

Hi! I want to customize my form appearance when it is opened in restored
position. I want to customize its appearance according to my specification
and make its size such as to appear in the centre of the screen. Please guide
me about how to write the code to accomplish the task and can the other forms
in the application all be coded such so as to appear in the same position as
the main form is appearing. Thanks in advance.
 
I

Imran Ghani

Hi Erez
Thanks for your helpful notes. I have created a form and also set its
autocenter property to yes, but when I resize it to restore position, the
form contents does not come in the centre of the form. If I try to change its
size in design mode, the contents does not come in center when form is
maximized. Kindly guide me about how to arrange the contents of the form in
the center of the screen, even its maximized or restored.
 
I

Imran Ghani

Hi Erez
Thanks for your helpful notes. I have created a form and also set its
autocenter property to yes, but when I resize it to restore position, the
form contents does not come in the centre of the form. If I try to change its
size in design mode, the contents does not come in center when form is
maximized. Kindly guide me about how to arrange the contents of the form in
the center of the screen, even its maximized or restored.
 
J

Jack Leach

when I resize it to restore position, the
form contents does not come in the centre of the form. If I try to change its
size in design mode, the contents does not come in center when form is
maximized. Kindly guide me about how to arrange the contents of the form in
the center of the screen, even its maximized or restored.


In order to accomplish this you will need to the the Width and Height of the
form, and calculate where you want to place the controls based off of those.
The control Top and Left properties can be set (in Twips) to the desired
position via code.

The Width property of the form is fairly straightforward... Me.Width will
return the number of Twips wide the form is (1inch = 1440 Twips, but Pixels
require special handling).

The Height property is a bid more advanced... there actually is no Form
Height property. You need to calculate each Section height to get the total
form height.

Me.Section(0).Height + Me.Section(1).Height

If you have a header and footer, the header is (0), the detail is (1) and
the footer is (2). However, if you don't have these active then the detail
will be (0) and anything else will throw an error.

So all in all, to accomplish this, you'll be looking at a decent amount of
calculating and placing to get everything where you want it.

Personally, I think it's easier to keep all the controls based off the top
left of the form, and resize/reposition the form accordingly (using the
DoCmd.Move method).

hth

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
J

Jack Leach

when I resize it to restore position, the
form contents does not come in the centre of the form. If I try to change its
size in design mode, the contents does not come in center when form is
maximized. Kindly guide me about how to arrange the contents of the form in
the center of the screen, even its maximized or restored.


In order to accomplish this you will need to the the Width and Height of the
form, and calculate where you want to place the controls based off of those.
The control Top and Left properties can be set (in Twips) to the desired
position via code.

The Width property of the form is fairly straightforward... Me.Width will
return the number of Twips wide the form is (1inch = 1440 Twips, but Pixels
require special handling).

The Height property is a bid more advanced... there actually is no Form
Height property. You need to calculate each Section height to get the total
form height.

Me.Section(0).Height + Me.Section(1).Height

If you have a header and footer, the header is (0), the detail is (1) and
the footer is (2). However, if you don't have these active then the detail
will be (0) and anything else will throw an error.

So all in all, to accomplish this, you'll be looking at a decent amount of
calculating and placing to get everything where you want it.

Personally, I think it's easier to keep all the controls based off the top
left of the form, and resize/reposition the form accordingly (using the
DoCmd.Move method).

hth

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 

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