Solved

Scrolling a form

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 79
Using an encrypted  value to decrypt and display contents in vb6 9 52
Added a column screws up code 5 59
MsgBox 4 62
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

825 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