On Resize

J

Jim Bunton

Private Sub Form_Resize()
Debug.Print "Mywidth is " & Me.width & " and height is " &
Me.Section(acDetail).height
End Sub

produces:-
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406

i.e.when I resize the open form and resize it then its reported width and
section height properties do not change.

[I want these values to alter the size of a control on the form to
dynamically adjustwith the form size.
Is this possible??]
 
R

Rick Brandt

Jim said:
Private Sub Form_Resize()
Debug.Print "Mywidth is " & Me.width & " and height is " &
Me.Section(acDetail).height
End Sub

produces:-
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406

i.e.when I resize the open form and resize it then its reported width
and section height properties do not change.

[I want these values to alter the size of a control on the form to
dynamically adjustwith the form size.
Is this possible??]

You mean when you resize with the mouse? You are in fact not resizing the
"form". You are merely resizing its window.

Try looking at the InsideHeight and InsideWidth properties. That will give
you the dimensions of the window which you can use to make relative changes
to the size and/or positions of objects on the form.

Note that you will often have to first change the size of the form sections
as you are not allowed to position or size an object such that it exceeds
that boundary. When going in the other direction (smaller) you have to
reverse the order and move/resize the objects first and then resize the form
section.
 
J

Jim Bunton

Rick Brandt said:
Jim said:
Private Sub Form_Resize()
Debug.Print "Mywidth is " & Me.width & " and height is " &
Me.Section(acDetail).height
End Sub

produces:-
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406
Mywidth is 10714 and height is 6406

i.e.when I resize the open form and resize it then its reported width
and section height properties do not change.

[I want these values to alter the size of a control on the form to
dynamically adjustwith the form size.
Is this possible??]

You mean when you resize with the mouse? You are in fact not resizing the
"form". You are merely resizing its window.

Try looking at the InsideHeight and InsideWidth properties. That will
give you the dimensions of the window which you can use to make relative
changes to the size and/or positions of objects on the form.

Note that you will often have to first change the size of the form
sections as you are not allowed to position or size an object such that it
exceeds that boundary. When going in the other direction (smaller) you
have to reverse the order and move/resize the objects first and then
resize the form section.
Thanks Rick,
Isn't life complicated!
Yes - I did mean resize with the mouse.
I think I'll be able to get to where I want now.

Thanks in particular for the detail 'warnings' about exceding boundaries and
the need to be particularly aware of this when resizing smaller.

Jim Bunton
 
P

pddxxx

Actually, you can position a form control outside of the form section
- the section will be expanded to fit the new position of the control.
Moving the control will "push" the section right and bottom borders
around. This can be confusing if you later try to expand the section
by the same percentage as you did the control.

Peter De Baets
http://www.peterssoftware.com
 
R

Rick Brandt

Actually, you can position a form control outside of the form section
- the section will be expanded to fit the new position of the control.
Moving the control will "push" the section right and bottom borders
around. This can be confusing if you later try to expand the section
by the same percentage as you did the control.

That is not my experience unless this behavior was changed in later
versions.

You are talking about moving and resizing programmatically right?
 

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