|
-
Aug 8th, 2002, 09:42 AM
#1
Thread Starter
New Member
form size vs. screen resolution
how do you determine form size (height and width) based on selected system screen resolution?
example: if monitor resolution is set for 800x600 what would be the form size (height and width) if i wanted the form to be same size as screen?
what is the relation of the height and width indicated in VB6 to the screen resolution?
-
Aug 8th, 2002, 09:43 AM
#2
Frenzied Member
VB Code:
Form1.Width = Screen.Width
Form1.Height = Screen.Height
-
Aug 8th, 2002, 09:44 AM
#3
Retired VBF Adm1nistrator
VB Code:
Private Sub Form_Load()
Hide
ScaleMode = 3: Left = 0
Width = Screen.Width: Height = Screen.Height:
Show
End Sub
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 8th, 2002, 09:52 AM
#4
Frenzied Member
along these lines... let's say I have a few controls I want to center on the screen depending on the resolution.
I've tried:
VB Code:
txtbox.Top = Screen.Width/2
txtbox.Left = Screen.Height/2
But this doesn't work. Help!?
-
Aug 8th, 2002, 09:55 AM
#5
Retired VBF Adm1nistrator
Hmmm well you'd want to use Me.Width instead of Screen.Width, make sure ScaleMode = 3, and also, to center, you have to subtract half the width/height of the object from the left/top position too
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 8th, 2002, 09:57 AM
#6
Frenzied Member
why would it matter whether I use Me or Screen, since they should be the same thing?
-
Aug 8th, 2002, 09:58 AM
#7
Frenzied Member
txtbox.left = (me.scalewidth - txtbox.width)/2
txtbox.top = (me.scaleheight - txtbox.height)/2
-
Aug 8th, 2002, 09:59 AM
#8
Retired VBF Adm1nistrator
Me refers to the current Form, whereas Screen refers to the screen.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 8th, 2002, 10:02 AM
#9
Frenzied Member
alright... thanks guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|