|
-
Apr 29th, 2005, 03:14 PM
#1
Thread Starter
Lively Member
[Resolved]Centre Objects...?
Hey, I have a picture box that's 11475 in width and 7545 in height. When the form is resized how do I keep it in the very centre of the form?
Thanks in advance
Last edited by BefunMunkToloGen; Apr 29th, 2005 at 03:26 PM.
-
Apr 29th, 2005, 03:17 PM
#2
PowerPoster
Re: Centre Objects...?
picture.left = (form.width / 2) - (picture.width /2)
-
Apr 29th, 2005, 03:17 PM
#3
Re: Centre Objects...?
Use Screen.Width/Height or Form.Width/Height
Calculate the center of the x and y location and move it there.
-
Apr 29th, 2005, 03:17 PM
#4
Re: Centre Objects...?
You will need to do somthing like this in the form_resize() event
VB Code:
Private Sub Form_Resize()
Picture1.ScaleMode = vbPixels
Form1.ScaleMode = vbPixels
Picture1.Left = (Form1.ScaleWidth / 2) - (Picture1.ScaleWidth / 2)
Picture1.Top = (Form1.ScaleHeight / 2) - (Picture1.ScaleHeight / 2)
End Sub
-
Apr 29th, 2005, 03:21 PM
#5
Thread Starter
Lively Member
Re: Centre Objects...?
Sorted cheers . For some reason i was doing frmGame.width - PBox.width / 2
-
Apr 29th, 2005, 03:23 PM
#6
Re: Centre Objects...?
 Originally Posted by BefunMunkToloGen
Sorted cheers  . For some reason i was doing frmGame.width - PBox.width / 2
No problem if you could edit your origional post and add resolved to the title that would be great 

Pino
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
|