473,834 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 18723
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********@aus tin.rr.com> wrote in message
news:10******** *****@corp.supe rnews.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).H eight
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.Hei ght = Me.Section(0).H eight / 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.7529 56$Pk3.187813@p d7tw1no...
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).H eight
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.Hei ght = Me.Section(0).H eight / 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********@aus tin.rr.com> wrote in message
news:10******** *****@corp.supe rnews.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*********@Se eSig.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********@aus tin.rr.com> wrote in message
news:10******** *****@corp.supe rnews.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
2783
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 to be able to obtain the unicode character codes for each individual letter/symbol. Is this possible in PHP? If so, can you please provide a short code snippet. We looked at the mbstring extension but found nothing helpful, especially
4
5923
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 would move out of the bottom screen area, I would want to move it up by that fraction so that it displays at the bottom of the screen. To do this, I would need to acquire the height of the SELECT element. I tried quite a few methods. ...
12
10184
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 scrollbar, you get the height of the entire document, screwing up any chance of centering a window in the browser using these values. Is there a way to get the height of the actual browser window and not the entire page height? Thanks.
6
5207
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 WM_SIZE = &H5 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Call MyBase.WndProc(m)
2
1301
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 = GetDeviceCaps(lHdc, PHYSICALOFFSETY)
1
2345
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 forth to the next and previous day. Since the number of items in the list can vary from day to day - from zero one day to thirty another, and five the third - my users like the option to have the Window resize itself to exactly fit the number of
1
3381
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 altezza ad un valore diverso da 21. Forse, cambiando la dimensione del font, si potrebbe riuscire a cambiare anche l'impostazione dell'altezza... (MS farebbe comunque meglio ad introdurre per il ComboBox una proprietà AutoSize impostabile a "false"...
1
5610
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 appropriate for the typical screen resolution they were using. Now some users have decided to use higher screen resolutions, up to 1280/1024. When they maximize the form, that of course works but the size of the main form control containing the...
4
2487
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; width: 100%; height: 90%" BorderColor="Maroon"
0
10789
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10544
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5624
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5790
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3079
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.