Solved

Scrolling a form

Posted on 2004-09-28
3
156 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

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

932 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

12 Experts available now in Live!

Get 1:1 Help Now