Solved

Scrolling a form

Posted on 2004-09-28
3
155 Views
Last Modified: 2010-05-02
Hello,

I have a form which runs off the user's screen, but only at resolution 800x600. (I don't really care about 640x480). I need to make this a scrollable form, but only for this resolution (or only when the form runs off the screen) It runs off at the bottom only, and I am centering the form in the middle of the screen. Further complicating things, this form has a picture as a background. I line up various controls (buttons, textboxes, etc.) to areas of the picture, so simply moving all the controls around will not work. I've found code which illustrates how to make a form scrollable and moves all form elements (using a picturebox I believe), but I need code that can detect the user resolution or when a form runs off the screen, and only in that case add a scrollbar to the form.

Any suggestions?
0
Comment
Question by:rite_eh
3 Comments
 
LVL 1

Accepted Solution

by:
VBtorment earned 245 total points
ID: 12174767
Yo, rite

maybe ya can use the screen object
try this
put this on Form_Load

MsgBox (Screen.Width / Screen.TwipsPerPixelX) & " " & (Screen.Height / Screen.TwipsPerPixelY)

it will show a messageBox with the resolution you are using.
0
 
LVL 1

Author Comment

by:rite_eh
ID: 12177016
I had no idea this object existed. That is very helpful. Do you know of a way to reposition a window in the center of the user's screen at runtime?
0
 
LVL 8

Assisted Solution

by:mladenovicz
mladenovicz earned 100 total points
ID: 12177776
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

708 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