Solved

Lock command buttons in place

Posted on 2013-02-02
10
267 Views
Last Modified: 2013-02-07
I have a form with a background photo. The form has command buttons that are positioned in place relative to elements in the background picture.  They stay where I want them on my monitor but if I run the program on various monitors they don't stay in place.

Has any one had experience with this and have a solution?
0
Comment
Question by:SteveL13
10 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 38846659
Form properties:

Me.WindowWidth
Me.WindowLeft
Me.WindowWidth
Me.WindowHeight

You use these values to calculate Button.Left, Button.Top.
For example: Me.Button1.Left=Me.WindowWidth/10  ' starts at the first 1/10the size of the form
                      Me.Button1.Top=Me.WindowHeight/10
0
 

Author Comment

by:SteveL13
ID: 38846714
Hmmm..not sure I understand.

My picture is in the detail section of the form.  The detail section is 6.625" height and 9" width.

All of the buttons are 1" wide x .3333" height.

The first one for example is positioned at .875 top and .3021 left.

How to I alter your code to do what you are telling me?
0
 
LVL 30

Expert Comment

by:hnasr
ID: 38846729
Try to create a simple form with a picture and 2 buttons.
Tell me when I run the form: What to look for and what to expect and what to modify.
0
 

Author Comment

by:SteveL13
ID: 38846750
Please see the attachment.  As you can see there are buttons, (actually they are labels with on click events that won't work in this example because thaere are no back end tables).

The "buttons" need to line up with the picture.  I've also included a snapshot of the form as it appears on my monitor and as I want it to appear on any monitor.

--Steve
Example.accdb
snapshot.jpg
0
 
LVL 39

Expert Comment

by:als315
ID: 38846856
You should not center your picture. Access buttons can't follow this centering.
picture
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 30

Expert Comment

by:hnasr
ID: 38847127
Try aligning buttons to respective labels on open event of form.

Private Sub Form_Open(Cancel As Integer)
    Me.CAForm.Left = Me.Label80.Left
    Me.CAForm.Top = Label80.Top + Me.Label80.Height
    'repeat for other buttons with respective labels
End Sub

Open in new window

0
 

Author Comment

by:SteveL13
ID: 38847367
Sorry... still not understanding.  What does the CAForm represent?
0
 
LVL 30

Expert Comment

by:hnasr
ID: 38847606
This is control name.
check the database Form_Open event.
Example-Q-28017794.accdb
0
 

Author Comment

by:SteveL13
ID: 38849196
I don't think this is working.  I can see how we can set the position of a label relative to another label.  But I don't how we're telling the form where to set, for example, the upper left label to the position of the background picture when the background picture is going to change depending on the resolution of the monitor.

Am I wrong?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 38853594
This is the problem with trying to do things like this.
It is a nightmare trying to adjust the "screen" positions of a control based on image that will distort/skew for each users resolution.
It can be done, but rarely worth the trouble IMHO.

Not only the position, ...but the relative "size" of the control may also need to be adjusted...
(a control that is a good size at 800x600 may be too small at 1280X1024, or even smaller on some hi-res/wide screen resolutions)

Perhaps a utility like this is your best shot:
http://www.peterssoftware.com/ss.htm


JeffCoachman
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Access creating a Chart from Search result on Form view 2 22
Syntax Error in Query 7 31
MS accesss using VBA to change a default value 5 30
Running sum query 6 34
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now