Results 1 to 10 of 10
  1. #1
    sharkey_lsu is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Aug 2013
    Posts
    31

    Image Frame Proportional Scaling

    I have a form with three images. I am trying to make this form responsive so that it can be used on a tablet and in portrait or landscape mode. I currently have three images that are part of a layout and set to stretch across and down so that the screen size is properly utilized. The issue I have, however, is that the frame is not proportional to the images. Is there a way to set the frame to stretch proportionally?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    In the frame property format, set SIZE MODE to STRETCH

  3. #3
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Apr 2015
    Posts
    128
    What is this "frame" you refer to? Is it the border of the image control? Is it a "rectangle" you made yourself using the line control? Is it the borders of the form itself? Note that to change a form's width and height, you need to use the hidden properties InsideWidth and InsideHeight.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    yes, the box the image is in. click the frame
    properties
    format
    sizemode

  5. #5
    sharkey_lsu is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Aug 2013
    Posts
    31
    I want the frame size to be based on a set proportion. The images will be square and therefore the frame also needs to be square. I can make the frames not stretch but this is not responsive and does not make good utilization of screen real estate. The image below shows what my issue is:

    Click image for larger version. 

Name:	1.jpg 
Views:	10 
Size:	116.9 KB 
ID:	20389

  6. #6
    sharkey_lsu is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Aug 2013
    Posts
    31
    I do not want the image to adjust to the frame, I want the frame to adjust based on the same proportion as the image. If I change sizemode to anything other than zoom, it will alter the image (crop some of it out, stretch out the image, etc)

  7. #7
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    I want the frame size to be based on a set proportion
    So what you mean is you want to resize the image control based on the available screen size/shape?

    I suggest you would use the form resize event which compares the insidewidth of the form, adjusted for any left/right margins you need to allow for, divided by the number of image controls (this gives you a 'max width' for a control) with the insideheight of the form, less any margins, then set the control height and width properties to the lower of the two and the left property to the sum of the widths of the controls to the left, less any left margin. You could look at the .move action to set these all in one.

  8. #8
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Apr 2015
    Posts
    128
    Quote Originally Posted by sharkey_lsu View Post
    I do not want the image to adjust to the frame, I want the frame to adjust based on the same proportion as the image. If I change sizemode to anything other than zoom, it will alter the image (crop some of it out, stretch out the image, etc)
    If you are sure the images will always be square, then just make sure the image control's border (the frame you refer to) has the same height and width at all times (with VBA code). Or you can make the border disappear by setting the border style to "hairline", and the control's background color to the same as the form's background.

  9. #9
    sharkey_lsu is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Aug 2013
    Posts
    31
    Quote Originally Posted by Ajax View Post
    So what you mean is you want to resize the image control based on the available screen size/shape?

    I suggest you would use the form resize event which compares the insidewidth of the form, adjusted for any left/right margins you need to allow for, divided by the number of image controls (this gives you a 'max width' for a control) with the insideheight of the form, less any margins, then set the control height and width properties to the lower of the two and the left property to the sum of the widths of the controls to the left, less any left margin. You could look at the .move action to set these all in one.
    Do you know where I could find an example of something like this? I am not very good at writing code but am able to edit code.

  10. #10
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    code would be something like this for a square control and assumes the image controls are called i1, i2, i3

    dim hwidth as single
    dim vheight as single
    dim I as integer

    hwidth=(insidewidth-i1.left-60)/3
    vheight=insideheight-i1.top-60

    if hwidth<vheight then 'max size is based on width
    for I=1 to 3
    me("I" & I).width=hwidth
    me("I" & I).height=hwidth
    me("I" & I).left=hwidth*(I-1)+i1.left
    next I
    else
    for I=1 to 3
    me("I" & I).width=vheight
    me("I" & I).height=vheight
    me("I" & I).left=vheight*(I-1)+i1.left
    next I
    End if

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Race car scaling (complicated)
    By BEI77 in forum Programming
    Replies: 1
    Last Post: 07-28-2014, 03:37 PM
  2. Scaling a Chart Axis
    By Paul H in forum Reports
    Replies: 5
    Last Post: 10-16-2013, 01:50 PM
  3. Replies: 3
    Last Post: 10-21-2012, 02:25 PM
  4. Replies: 1
    Last Post: 05-30-2012, 03:51 PM
  5. Replies: 0
    Last Post: 04-22-2011, 04:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums