[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)
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
Re: [2005] I'm making a background changer
you could stretch/shrink the image
vb Code:
Dim fileName As String = "WallPaper"
Dim imagePath As String = IO.Path.Combine(Environment.ExpandEnvironmentVariables("%windir%\Web\Wallpaper"), fileName)
Dim img As New Bitmap(PictureBox1.Image, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
img.Save(imagePath, System.Drawing.Imaging.ImageFormat.Bmp)
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE)