473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to Obtain the Height of a Form?

How can one obtain obtain the height of a MS Access 2K form?

There is a width property, but I don't see a corresponding height property.
I need to obtain the height of the form so that I can dynamically resize an
object on the form in the form's Form_Resize method when a user resizes the
form, both horizontally and vertically.

Thanks,
s/KAM

Nov 13 '05 #1
5 18569
Sum the Height of the sections of the form.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Kevin Myers" <Ke********@austin.rr.com> wrote in message
news:10*************@corp.supernews.com...
How can one obtain obtain the height of a MS Access 2K form?

There is a width property, but I don't see a corresponding height property. I need to obtain the height of the form so that I can dynamically resize an object on the form in the form's Form_Resize method when a user resizes the form, both horizontally and vertically.

Nov 13 '05 #2
Bri
Kevin,

The total Height of a Form is the sum of the Height of all of the
Sections (Form Header/Footer) and the Detail(s) so there is no one place
for it. If the Height of your headers and footers are contant and you
are not using a continous form then you can add the Detail section to
your header/footer heights. Also, keep in mind that the Height (and
Width) are actualy stored as Twips (1440 twips = 1 inch).

From the Help:

· The Height property applies only to form sections and report sections,
not to forms and reports.
· The Width property applies only to forms and reports, not to form
sections and report sections.
· Both properties apply to controls on forms and reports.

The height of sections and the width of forms and reports are measured
from the inside of their borders.
Air Code
========

For I=0 to 4 '(the five sections of a Form, Report has nine)
lTotalTwips = lTotalTwips + Me.Section(I).Height
Next

Msgbox "The total Height of the Form is: " & _
lTotalTwips /1440 & " Inches"

=========

The Section Properties are read only.

If the object you want to resize is in the Detail Section and you want
it to be a ratio of the Detail Height then:

Air Code
========

'Assume object is to be 50% of the height of the Form Detail Section
Me.MyObject.Height = Me.Section(0).Height / 2

=========

Hope that helps

Bri
Kevin Myers wrote:
How can one obtain obtain the height of a MS Access 2K form?

There is a width property, but I don't see a corresponding height property.
I need to obtain the height of the form so that I can dynamically resize an
object on the form in the form's Form_Resize method when a user resizes the
form, both horizontally and vertically.

Thanks,
s/KAM


Nov 13 '05 #3
Thanks to both Allen and Bri for their very helpful comments. Based on what
they said, here is what I put in the code for my form:

Private Sub Form_Resize()
If (Me.Width / 1440) <= 10 Then ImgEdit1.Width = 4.9167 * 1440 Else
ImgEdit1.Width = Me.Width - 5.0833 * 1440
If (Detail.Height / 1440) <= 7.5 Then ImgEdit1.Height = 7.3333 * 1440 Else
ImgEdit1.Height = Detail.Height - 0.1667 * 1440
End Sub

Unfortunately this still isn't working. The method does seem to be
executing when the form is resized, but the values of Me.Width and
Detail.Height don't seem to be changing. In the properties for the form the
Default View is set to Single Form, Auto Resize is set to No and Border
Style is set to Sizable. In properties for the Detail section, Can Grow and
Can Shrink are both set to Yes, while for the Form Header and Form Footer
sections these properties are both set to No.

What am I overlooking?

Thanks,
s/KAM
"Bri" <no*@here.com> wrote in message
news:DjkAc.752956$Pk3.187813@pd7tw1no...
Kevin,

The total Height of a Form is the sum of the Height of all of the
Sections (Form Header/Footer) and the Detail(s) so there is no one place
for it. If the Height of your headers and footers are contant and you
are not using a continous form then you can add the Detail section to
your header/footer heights. Also, keep in mind that the Height (and
Width) are actualy stored as Twips (1440 twips = 1 inch).

From the Help:

· The Height property applies only to form sections and report sections,
not to forms and reports.
· The Width property applies only to forms and reports, not to form
sections and report sections.
· Both properties apply to controls on forms and reports.

The height of sections and the width of forms and reports are measured
from the inside of their borders.
Air Code
========

For I=0 to 4 '(the five sections of a Form, Report has nine)
lTotalTwips = lTotalTwips + Me.Section(I).Height
Next

Msgbox "The total Height of the Form is: " & _
lTotalTwips /1440 & " Inches"

=========

The Section Properties are read only.

If the object you want to resize is in the Detail Section and you want
it to be a ratio of the Detail Height then:

Air Code
========

'Assume object is to be 50% of the height of the Form Detail Section
Me.MyObject.Height = Me.Section(0).Height / 2

=========

Hope that helps

Bri
Kevin Myers wrote:
How can one obtain obtain the height of a MS Access 2K form?

There is a width property, but I don't see a corresponding height property. I need to obtain the height of the form so that I can dynamically resize an object on the form in the form's Form_Resize method when a user resizes the form, both horizontally and vertically.

Thanks,
s/KAM


Nov 13 '05 #4
Hi Kevin.

Right: if you physically drag the window size such that it is bigger than
the height of of the sections, then the height of the window has no
relationship to the height of the sections.

Stephen Lebans has a free downloadable example showing " a Form that
demonstrates the relationships of the Form and Section Height and Width
properties" in this link:
http://www.lebans.com/formdimensions.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Kevin Myers" <Ke********@austin.rr.com> wrote in message
news:10*************@corp.supernews.com...
Thanks to both Allen and Bri for their very helpful comments. Based on what they said, here is what I put in the code for my form:

Private Sub Form_Resize()
If (Me.Width / 1440) <= 10 Then ImgEdit1.Width = 4.9167 * 1440 Else
ImgEdit1.Width = Me.Width - 5.0833 * 1440
If (Detail.Height / 1440) <= 7.5 Then ImgEdit1.Height = 7.3333 * 1440 Else
ImgEdit1.Height = Detail.Height - 0.1667 * 1440
End Sub

Unfortunately this still isn't working. The method does seem to be
executing when the form is resized, but the values of Me.Width and
Detail.Height don't seem to be changing. In the properties for the form the Default View is set to Single Form, Auto Resize is set to No and Border
Style is set to Sizable. In properties for the Detail section, Can Grow and Can Shrink are both set to Yes, while for the Form Header and Form Footer
sections these properties are both set to No.

What am I overlooking?

Thanks,
s/KAM

Nov 13 '05 #5
Thanks for confirming my observations Allen. After further trial and error,
the following seems to be doing what I want fairly well. I'd appreciate it
if anyone would let me know if they see any obvious pitfalls to this
approach (note that my Form Header and Form Footer sections have a height of
zero):

Private Sub Form_Resize()
Me.Width = Me.InsideWidth - 0.25 * 1440
Detail.Height = Me.InsideHeight - 0.25 * 1440
If (Me.Width / 1440) <= 10 Then ImgEdit1.Width = 4.9167 * 1440 Else
ImgEdit1.Width = Me.Width - 5.0833 * 1440
If (Detail.Height / 1440) <= 7.5 Then ImgEdit1.Height = 7.3333 * 1440 Else
ImgEdit1.Height = Detail.Height - 0.1667 * 1440
ImgEdit1.FitTo 1
End Sub
Regards,
s/KAM


"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:40***********************@per-qv1-newsreader-01.iinet.net.au...
Hi Kevin.

Right: if you physically drag the window size such that it is bigger than
the height of of the sections, then the height of the window has no
relationship to the height of the sections.

Stephen Lebans has a free downloadable example showing " a Form that
demonstrates the relationships of the Form and Section Height and Width
properties" in this link:
http://www.lebans.com/formdimensions.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Kevin Myers" <Ke********@austin.rr.com> wrote in message
news:10*************@corp.supernews.com...
Thanks to both Allen and Bri for their very helpful comments. Based on

what
they said, here is what I put in the code for my form:

Private Sub Form_Resize()
If (Me.Width / 1440) <= 10 Then ImgEdit1.Width = 4.9167 * 1440 Else
ImgEdit1.Width = Me.Width - 5.0833 * 1440
If (Detail.Height / 1440) <= 7.5 Then ImgEdit1.Height = 7.3333 * 1440 Else ImgEdit1.Height = Detail.Height - 0.1667 * 1440
End Sub

Unfortunately this still isn't working. The method does seem to be
executing when the form is resized, but the values of Me.Width and
Detail.Height don't seem to be changing. In the properties for the form

the
Default View is set to Single Form, Auto Resize is set to No and Border
Style is set to Sizable. In properties for the Detail section, Can Grow

and
Can Shrink are both set to Yes, while for the Form Header and Form Footer sections these properties are both set to No.

What am I overlooking?

Thanks,
s/KAM


Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dominik Jain | last post by:
Hi! We hope somebody can help me with the following: We have a form through which unicode data might be submitted. We need to be able to detect when this happens and, most importantly, we need...
4
by: Rithish | last post by:
Is there a way to obtain the height of a <SELECT> element dynamically, i.e. through javascript? I want to dynamically display a list box onFocus of a text box element. Also, if the list box...
12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
6
by: Rob | last post by:
I need to create a form that will resize only the verticle size of the Form and not the width. So far I'm partial to the following code. Can someone please elaborate the ??? . . . . Const...
2
by: **Developer** | last post by:
THIS IS WHAT I DO: Dim lG As Graphics = pD.PrinterSettings.CreateMeasurementGraphics() Dim lHdc As IntPtr = lG.GetHdc() leftOffsetP = GetDeviceCaps(lHdc, PHYSICALOFFSETX) topOffsetP =...
1
by: Rune Jacobsen | last post by:
Hi all, I have an application with one particular form that lists a number of items in a listview. In addition to the listview, there is a panel on top with some simple controls to go back and...
1
by: polocar | last post by:
Ciao a tutti, leggendo qua e lą per il forum ho scoperto che non sono l'unico ad avere questo problema. Se si inserisce un controllo ComboBox in un form di C#, non č possibile impostare la sua...
1
by: Bob Alston | last post by:
I have a system where many subforms are used. Often the size of the subform had to be larger than could be displayed without scrolling. I set the height of the subform to the typical height...
4
by: AAaron123 | last post by:
<body runat="server" id="MainBody"> <form id="form1" runat="server" style="background-color:green; width: 100%; height: 100%"> <br /> Table1" runat="server" Style="background-color:Yellow;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.