Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Center image in picture box?

Center image in picture box?

Scheduled Pinned Locked Moved Visual Basic
graphicsquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leezardd
    wrote on last edited by
    #1

    I have the following simple code to place a background image and an animated image in a picture box. How can I get the animated image to be centered in the picture box? Dim myPBImage As Bitmap = New Bitmap("Dog.gif") Dim myPBBkgrd As Bitmap = New Bitmap("BackYardBkgrd.jpg") PictureBox1.BackgroundImage = CType((myPBBkgrd), System.Drawing.Image) ImageAnimator.Animate(myPBImage, New EventHandler(AddressOf OnFrameChange)) PictureBox1.Image = CType((myPBImage), System.Drawing.Image)

    H 1 Reply Last reply
    0
    • L leezardd

      I have the following simple code to place a background image and an animated image in a picture box. How can I get the animated image to be centered in the picture box? Dim myPBImage As Bitmap = New Bitmap("Dog.gif") Dim myPBBkgrd As Bitmap = New Bitmap("BackYardBkgrd.jpg") PictureBox1.BackgroundImage = CType((myPBBkgrd), System.Drawing.Image) ImageAnimator.Animate(myPBImage, New EventHandler(AddressOf OnFrameChange)) PictureBox1.Image = CType((myPBImage), System.Drawing.Image)

      H Offline
      H Offline
      H is here
      wrote on last edited by
      #2

      PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage

      L 1 Reply Last reply
      0
      • H H is here

        PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage

        L Offline
        L Offline
        leezardd
        wrote on last edited by
        #3

        Worked perfectly. Thanks! :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups