Placing conrols on a form

  • Follow


I have a form on whick I place about 50 images to form a diagram of where
boats are stored on different pontoons in a marina. Currently I store the Top
& Left position of each Image control using X Y Coordinates as well as the
path to the image to be displayed. This works perfectly on my home computer,
but not on other computers due to differemt resolutions and different screen
sizes. Another factor is the Access window size
There may also be problems with how the background image (the pontoons with
no boats) gets distorted. Just to add to the complication I use the
ShrinkerStretcher software from Peter's Software I feel that the way to get
over the problem with the Top & Left properties is store the percentage of
the form width & height rather than XY positions. How do I go about getting
the width and height after it has been resized. Note past tense as I don't
want to position the images until any re-sizing has been completed. Will this
work? Any pointers please
Thanks

Phil
0
Reply phil (911) 8/2/2012 5:54:55 PM


"Phil" <phil@stantonfamily.co.uk> wrote in message 
news:jveete$idr$1@speranza.aioe.org...
> I have a form on whick I place about 50 images to form a diagram of where
> boats are stored on different pontoons in a marina. Currently I store the 
> Top
> & Left position of each Image control using X Y Coordinates as well as the
> path to the image to be displayed. This works perfectly on my home 
> computer,
> but not on other computers due to differemt resolutions and different 
> screen
> sizes. Another factor is the Access window size
> There may also be problems with how the background image (the pontoons 
> with
> no boats) gets distorted. Just to add to the complication I use the
> ShrinkerStretcher software from Peter's Software I feel that the way to 
> get
> over the problem with the Top & Left properties is store the percentage of
> the form width & height rather than XY positions. How do I go about 
> getting
> the width and height after it has been resized. Note past tense as I don't
> want to position the images until any re-sizing has been completed. Will 
> this
> work? Any pointers please
> Thanks
>
> Phil

Look at examples for Me.InsideHeight and Me.InsideWidth will give you the 
size in twips 

0
Reply none10 (3395) 8/2/2012 8:22:09 PM


On 02/08/2012 21:22:10, "Ron Paii" wrote:
> 
> 
> "Phil" <phil@stantonfamily.co.uk> wrote in message
> news:jveete$idr$1@speranza.aioe.org...
>> I have a form on whick I place about 50 images to form a diagram of where
>> boats are stored on different pontoons in a marina. Currently I store the
>> Top
>> & Left position of each Image control using X Y Coordinates as well as the
>> path to the image to be displayed. This works perfectly on my home
>> computer,
>> but not on other computers due to differemt resolutions and different
>> screen
>> sizes. Another factor is the Access window size
>> There may also be problems with how the background image (the pontoons
>> with
>> no boats) gets distorted. Just to add to the complication I use the
>> ShrinkerStretcher software from Peter's Software I feel that the way to
>> get
>> over the problem with the Top & Left properties is store the percentage of
>> the form width & height rather than XY positions. How do I go about
>> getting
>> the width and height after it has been resized. Note past tense as I don't
>> want to position the images until any re-sizing has been completed. Will
>> this
>> work? Any pointers please
>> Thanks
>>
>> Phil
> 
> Look at examples for Me.InsideHeight and Me.InsideWidth will give you the
> size in twips
> 
> 

Thanks Ron, That looks a promising start. 

Any thoughts on the sizing method on the form's background picture to keep
the boat images relatively in the right pontoon spaces?

Phil
0
Reply phil (911) 8/2/2012 10:01:29 PM

"Phil" <phil@stantonfamily.co.uk> wrote

 > Any thoughts on the sizing method on the
 > form's background picture to keep
 > the boat images relatively in the right
 > pontoon spaces?

There three options: Clip, Stretch, and Zoom.  Zoom is the only one that 
preserves the proportion (aka aspect ratio) of the picture.  Access is 
surprisingly flexible in what it can do, but it's just not "graphics 
oriented software". With enough trial, error, and experimentation, people 
have made it do some astonishing things. I'm sure what you want to do is, at 
best, not going to be easy... and may not be possible.

 Larry Linson
 Microsoft Office Access MVP



0
Reply accdevel (397) 8/3/2012 3:27:13 AM

On 03/08/2012 04:27:15, "Access Developer" wrote:
> "Phil" <phil@stantonfamily.co.uk> wrote
> 
> > Any thoughts on the sizing method on the
> > form's background picture to keep
> > the boat images relatively in the right
> > pontoon spaces?
> 
> There three options: Clip, Stretch, and Zoom.  Zoom is the only one that
> preserves the proportion (aka aspect ratio) of the picture.  Access is
> surprisingly flexible in what it can do, but it's just not "graphics
> oriented software". With enough trial, error, and experimentation, people
> have made it do some astonishing things. I'm sure what you want to do is,
> at best, not going to be easy... and may not be possible.
> 
> Larry Linson
> Microsoft Office Access MVP
> 
> 
> 

THanks Larry. 
I am not worried about preserving the aspect ratio of the background
pictures, as they are rather crude drawings of the pontoons. So if I view the
picture on a wide screen monitor, I am happy that the pontoons get stretched
horizontally. The task is to get the spacing between the boats on that
pontoon to stretch the same amount. Certainly looks as if I nood the SizeMode
to stretch, rather than Zoom to fill the whole form.

Phil
0
Reply phil (911) 8/3/2012 7:58:22 AM


"Phil" <phil@stantonfamily.co.uk> wrote in message 
news:jvg0av$tnh$1@speranza.aioe.org...
> On 03/08/2012 04:27:15, "Access Developer" wrote:
>> "Phil" <phil@stantonfamily.co.uk> wrote
>>
>> > Any thoughts on the sizing method on the
>> > form's background picture to keep
>> > the boat images relatively in the right
>> > pontoon spaces?
>>
>> There three options: Clip, Stretch, and Zoom.  Zoom is the only one that
>> preserves the proportion (aka aspect ratio) of the picture.  Access is
>> surprisingly flexible in what it can do, but it's just not "graphics
>> oriented software". With enough trial, error, and experimentation, people
>> have made it do some astonishing things. I'm sure what you want to do is,
>> at best, not going to be easy... and may not be possible.
>>
>> Larry Linson
>> Microsoft Office Access MVP
>>
>>
>>
>
> THanks Larry.
> I am not worried about preserving the aspect ratio of the background
> pictures, as they are rather crude drawings of the pontoons. So if I view 
> the
> picture on a wide screen monitor, I am happy that the pontoons get 
> stretched
> horizontally. The task is to get the spacing between the boats on that
> pontoon to stretch the same amount. Certainly looks as if I nood the 
> SizeMode
> to stretch, rather than Zoom to fill the whole form.
>
> Phil

I think you will need to calculate those ratios then use the same math to 
recalculate after the form is resized. This is an example of a on resize 
event that changes the size of a subform when the use drags the main form.

Private Sub Form_Resize()
    On Error Resume Next

    Const LeftRightPadding = (0.3) * 1440
    Const SubFormWidth = (6.5 * 1440)

    Const DetailHeight = (1.0833 * 1440)
    Const SubFormHeight = (1 * 1440)
    Const TopBottomPadding = ((3.9167 + 1.4167) * 1440) + DetailHeight - 
SubFormHeight

    Dim iSubHeight As Integer
    Dim iSubWidth As Integer

    iSubHeight = MaxV(Me.InsideHeight - TopBottomPadding, SubFormHeight)
    iSubWidth = MaxV(Me.InsideWidth - LeftRightPadding, SubFormWidth)

    ' Resize detail section to fit new subform size
    Me.Section(acDetail).Height = DetailHeight - SubFormHeight + iSubHeight
    Me.Width = LeftRightPadding - SubFormWidth + iSubWidth

    ' Resize subform
    Me.frmsJobPart.Height = iSubHeight
    Me.frmsJobPart.Width = iSubWidth
End Sub 

0
Reply none10 (3395) 8/3/2012 12:12:36 PM

Why not do all the sizing, positioning, stretching/shrinking yourself at 
runtime?

When your form opens use the GetDeviceCaps API to grab the screen size and 
horizontal & vertical resolution of the display.  If you're not familiar 
with the differences between Twips and Pixels there's plenty of stuff Google 
will find you, including conversion functions.

You can then calculate how big you want your form and hence the positions 
and sizes of your image controls relative to the size of your form. On 
resize just repeat the calculations.

If you name the image controls e.g. img1, img2 etc. you will be able to loop 
through them pretty easily.  You could decide whether to preserve the aspect 
ratios of the Form and Image controls or not and hence the images.

HTH






"Phil" <phil@stantonfamily.co.uk> wrote in message 
news:jvg0av$tnh$1@speranza.aioe.org...
> On 03/08/2012 04:27:15, "Access Developer" wrote:
>> "Phil" <phil@stantonfamily.co.uk> wrote
>>
>> > Any thoughts on the sizing method on the
>> > form's background picture to keep
>> > the boat images relatively in the right
>> > pontoon spaces?
>>
>> There three options: Clip, Stretch, and Zoom.  Zoom is the only one that
>> preserves the proportion (aka aspect ratio) of the picture.  Access is
>> surprisingly flexible in what it can do, but it's just not "graphics
>> oriented software". With enough trial, error, and experimentation, people
>> have made it do some astonishing things. I'm sure what you want to do is,
>> at best, not going to be easy... and may not be possible.
>>
>> Larry Linson
>> Microsoft Office Access MVP
>>
>>
>>
>
> THanks Larry.
> I am not worried about preserving the aspect ratio of the background
> pictures, as they are rather crude drawings of the pontoons. So if I view 
> the
> picture on a wide screen monitor, I am happy that the pontoons get 
> stretched
> horizontally. The task is to get the spacing between the boats on that
> pontoon to stretch the same amount. Certainly looks as if I nood the 
> SizeMode
> to stretch, rather than Zoom to fill the whole form.
>
> Phil 


0
Reply jon.lewis4402 (7) 8/3/2012 2:05:04 PM

On Fri, 3 Aug 2012 07:12:36 -0500, "Ron Paii" <None@none.com> wrote:

>
>
>"Phil" <phil@stantonfamily.co.uk> wrote in message 
>news:jvg0av$tnh$1@speranza.aioe.org...
>> On 03/08/2012 04:27:15, "Access Developer" wrote:
>>> "Phil" <phil@stantonfamily.co.uk> wrote
>>>
>>> > Any thoughts on the sizing method on the
>>> > form's background picture to keep
>>> > the boat images relatively in the right
>>> > pontoon spaces?
>>>
>>> There three options: Clip, Stretch, and Zoom.  Zoom is the only one that
>>> preserves the proportion (aka aspect ratio) of the picture.  Access is
>>> surprisingly flexible in what it can do, but it's just not "graphics
>>> oriented software". With enough trial, error, and experimentation, people
>>> have made it do some astonishing things. I'm sure what you want to do is,
>>> at best, not going to be easy... and may not be possible.
>>>
>>> Larry Linson
>>> Microsoft Office Access MVP
>>>
>>>
>>>
>>
>> THanks Larry.
>> I am not worried about preserving the aspect ratio of the background
>> pictures, as they are rather crude drawings of the pontoons. So if I view 
>> the
>> picture on a wide screen monitor, I am happy that the pontoons get 
>> stretched
>> horizontally. The task is to get the spacing between the boats on that
>> pontoon to stretch the same amount. Certainly looks as if I nood the 
>> SizeMode
>> to stretch, rather than Zoom to fill the whole form.
>>
>> Phil
>
>I think you will need to calculate those ratios then use the same math to 
>recalculate after the form is resized. This is an example of a on resize 
>event that changes the size of a subform when the use drags the main form.
>
>Private Sub Form_Resize()
>    On Error Resume Next
>
>    Const LeftRightPadding = (0.3) * 1440
>    Const SubFormWidth = (6.5 * 1440)
>
>    Const DetailHeight = (1.0833 * 1440)
>    Const SubFormHeight = (1 * 1440)
>    Const TopBottomPadding = ((3.9167 + 1.4167) * 1440) + DetailHeight - 
>SubFormHeight
>
>    Dim iSubHeight As Integer
>    Dim iSubWidth As Integer
>
>    iSubHeight = MaxV(Me.InsideHeight - TopBottomPadding, SubFormHeight)
>    iSubWidth = MaxV(Me.InsideWidth - LeftRightPadding, SubFormWidth)
>
>    ' Resize detail section to fit new subform size
>    Me.Section(acDetail).Height = DetailHeight - SubFormHeight + iSubHeight
>    Me.Width = LeftRightPadding - SubFormWidth + iSubWidth
>
>    ' Resize subform
>    Me.frmsJobPart.Height = iSubHeight
>    Me.frmsJobPart.Width = iSubWidth
>End Sub 

Thanks Ron. I will play around with it next week. Looks as if there is
some
useful stuff there.

Phil
0
Reply phil (911) 8/5/2012 8:18:52 AM

7 Replies
45 Views

(page loaded in 0.703 seconds)


Reply: