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 :)
Printable View
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 :)
picture.left = (form.width / 2) - (picture.width /2)
Use Screen.Width/Height or Form.Width/Height
Calculate the center of the x and y location and move it there.
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
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 :)Quote:
Originally Posted by BefunMunkToloGen
:)
Pino