Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-access > #10178
| From | "Ron Paii" <None@none.com> |
|---|---|
| Newsgroups | comp.databases.ms-access |
| Subject | Re: Postitioning a control in a form |
| Date | 2014-12-10 11:29 -0600 |
| Organization | A noiseless patient Spider |
| Message-ID | <m69vte$80n$1@dont-email.me> (permalink) |
| References | <b76f269d-5fc0-4ce3-88d5-845de07d521e@googlegroups.com> <m69hs0$c01$1@dont-email.me> <67bc93ab-0224-4fab-b88a-89110f7ce3fd@googlegroups.com> |
"Patrick Finucane" <patrickfinucanetx@gmail.com> wrote in message
news:67bc93ab-0224-4fab-b88a-89110f7ce3fd@googlegroups.com...
> On Wednesday, December 10, 2014 8:30:00 AM UTC-5, Ron Paii wrote:
>> "Patrick Finucane" <patrickfinucanetx@gmail.com> wrote in message
>> news:b76f269d-5fc0-4ce3-88d5-845de07d521e@googlegroups.com...
>> > Hi. I have a form, Form1, that has a box/rectangle control. I call it
>> > Box0.
>> >
>> > I want to open a form, Form2, and position it at the Top Left
>> > coordinate
>> > of Form1's Box0. I think I may have the placement of that issue
>> > licked,
>> > maybe not.
>> >
>> > Anyway, when Form2 is displayed, I may resize it within Box0. At this
>> > point I can get the various coordinates of Form2 using WindowLeft,
>> > WindowTop, WindowHeight, and WindowWidth. Ex: lngLeft = Me.WindowLeft
>> >
>> > Inside Form2 I have 2 controls; LabelW and LabelL (for length and
>> > width).
>> > I need to display LabelW in the middle of Form2's display and LabelL at
>> > the bottom of Form2. What I would normally consider an easy task is
>> > turning into frustration. How can I get LabelL to print/display just
>> > above the bottom of the form using VBA? How can I display LabelW so it
>> > displays halfway down the display area of Form2. Is there some way of
>> > doing so? Currently I'm doing things like
>> > Me.LabelL.Top = Me.WindowHeight - 360
>> > In the above line, I would think LabelL would display 1/4" (360) from
>> > the
>> > bottom of Form2.
>> >
>> > For some odd reason the WindowHeight of Form2 has no correlation with
>> > the
>> > height of the detail section in Form2. The detail section is a large
>> > number using the Design view setting of the height.
>> >
>> > At this point I don't know if using Move is the way to go or the
>> > setting
>> > of a control such as LabelL.Top = ...
>> >
>> > This should be really easy to do. But I'm lost.
>> >
>> > Btw, I am using A2013 and have it set to use Overlapping Windows, not
>> > tabbed documents.
>>
>>
>>
>> 1) You need to account for the border and header to get from WindowHeight
>> to
>> the detail section.
>> 2) All dimensions are in twips (1440 per inch or 567 per centimeter)
>>
>> PS: as posted by Ulrich, why not include it as a sub form?
>
> The reason is that I need to resize the form. I'd love to use a box but
> unless it is in design mode it does not move/can't resize.
>
> Do you have any idea how to get the height of the border?
Use the resize event.
The following will resize the detail section 1st then the sub form in the
detail section. The constants will need to be edited if the form is edited.
Private Sub Form_Resize()
On Error Resume Next
' Default detail height converted from inch to twips
Const DetailHeight = (2.5833 * 1440)
' Default sub form hight converted fro inch to twips
Const SubFormHeight = (1.9167 * 1440)
' Form size (header+footer in inch converted to twips) + detail -
subform in twips
Const TopBottomPadding = ((0.4167 + 0) * 1440) + DetailHeight -
SubFormHeight
Dim iSubHeight As Integer
iSubHeight = MaxV(Me.InsideHeight - TopBottomPadding, SubFormHeight)
' Resize detail section to fit new subform size
Me.Section(acDetail).Height = DetailHeight - SubFormHeight + iSubHeight
' Resize subform
Me.SubForm1.Height = iSubHeight
End Sub
Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-09 15:27 -0800
Re: Postitioning a control in a form Ulrich Möller <knobbi38@arcor.de> - 2014-12-10 03:32 +0100
Re: Postitioning a control in a form "Ron Paii" <None@none.com> - 2014-12-10 07:29 -0600
Re: Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-10 06:14 -0800
Re: Postitioning a control in a form "Ron Paii" <None@none.com> - 2014-12-10 11:29 -0600
Re: Postitioning a control in a form Dave W <davewi11@yahoo.co.uk> - 2014-12-13 11:12 +0000
Re: Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-10 07:20 -0800
Re: Postitioning a control in a form Ulrich Möller <knobbi38@arcor.de> - 2014-12-10 20:10 +0100
Re: Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-10 13:53 -0800
Re: Postitioning a control in a form "Ron Paii" <None@none.com> - 2014-12-10 16:33 -0600
Re: Postitioning a control in a form Ulrich Möller <knobbi38@arcor.de> - 2014-12-11 00:56 +0100
Re: Postitioning a control in a form "Phil" <phil@stantonfamily.co.uk> - 2014-12-11 08:57 +0000
csiph-web