Results 1 to 3 of 3

Thread: [2005] I'm making a background changer

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    [2005] I'm making a background changer

    The image is coming from my picture box but the iamges is bigger than my screen, this is my code how can i get it to fit the screen best?

    Code:
     Dim fileName As String = "WallPaper"
            Dim imagePath As String = IO.Path.Combine(Environment.ExpandEnvironmentVariables("%windir%\Web\Wallpaper"), fileName)
            PictureBox1.Image.Save(imagePath, System.Drawing.Imaging.ImageFormat.Bmp)
            SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE)

  2. #2
    Addicted Member sauronsmatrix's Avatar
    Join Date
    Jun 2008
    Location
    USA
    Posts
    133

    Re: [2005] I'm making a background changer

    not exactly sure what you want but you can use :
    Code:
    Screen.PrimaryScreen.Bounds
    to get the bounds or
    Code:
    Screen.PrimaryScreen.Bounds.Width
    Screen.PrimaryScreen.Bounds.Height
    to get the X by Y

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [2005] I'm making a background changer

    you could stretch/shrink the image

    vb Code:
    1. Dim fileName As String = "WallPaper"
    2. Dim imagePath As String = IO.Path.Combine(Environment.ExpandEnvironmentVariables("%windir%\Web\Wallpaper"), fileName)
    3. Dim img As New Bitmap(PictureBox1.Image, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    4. img.Save(imagePath, System.Drawing.Imaging.ImageFormat.Bmp)
    5. SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width