?
Solved

Lock command buttons in place

Posted on 2013-02-02
10
Medium Priority
?
312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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.

 

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 40

Expert Comment

by:als315
ID: 38846856
You should not center your picture. Access buttons can't follow this centering.
picture
0
 
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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

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