• Welcome to Valhalla Legends Archive.
 

center bitmap image in picturebox? [VB]

Started by VoOdOo, March 07, 2003, 08:39 PM

Previous topic - Next topic

VoOdOo

how would you center a bitmap image in a picturebox field in vb?  im just trying something out with a picture box image at the top of the interface of my binary bot looks cool, but also looks gay clear on the left ;)

could you do:

'     With picMain
'          .PictureAlignment = vbCenter  'or lvwCenter
'     End With

or would you have to like make 3 columns in the picturebox field and insert the bitmap the the middle one?

anyone help?

Grok

#1
Put your bitmap in a picturebox.  Call that pic1.  Set it to autosize so it fits the bitmap.

Put a second picturebox on the form.  Size it properly.  Call that pic2.

Cut pic1 and paste into pic2.  Edit pic2_resize event as such:

Private Sub pic2_Resize()
    pic1.move (pic2.width-pic1.width)\2, (pic2.height-pic1.height)\2
End Sub