Solved

Lock command buttons in place

Posted on 2013-02-02
10
255 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

743 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

15 Experts available now in Live!

Get 1:1 Help Now