Ver Mensaje Individual
  #6 (permalink)  
Antiguo 29/08/2009, 21:02
Trulala de cordoba
 
Fecha de Ingreso: octubre-2000
Mensajes: 1.692
Antigüedad: 24 años, 4 meses
Puntos: 19
Respuesta: Establecer como Fondo de Escritorio con VB 2005

Hola.

Un código que podes usar es este, te pide que selecciones una imagen por medio de filebrowse pero si queres lo podes adaptar para tu gusto:

Código PHP:
Imports System.Drawing
Imports System
.Drawing.Drawing2D
Imports System
.Drawing.Imaging

Public Class frmMain
    Inherits System
.Windows.Forms.Form
'api to set the systems parameters for changing the wallpaper
    
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer

    '
constants to be used with the above api
        
Private Const SPI_SETDESKWALLPAPER 20
        
Private Const SPIF_UPDATEINIFILE = &H1

Private Sub btnSetWallpaper_Click(ByVal sender As System.ObjectByVal e As          
                  
System.EventArgsHandles btnSetWallpaper.Click

        
'just some generic path and name for the image in the picturebox to save to
        Dim imagePath As String = Application.StartupPath & "\myNewWallpaper.bmp"

        
        pic.Image.Save(imagePath, ImageFormat.Bmp)

        '
set the parameters to change the wallpaper to the image you selected
        SystemParametersInfo
(SPI_SETDESKWALLPAPER0imagePathSPIF_UPDATEINIFILE)

    
End Sub

 
Private Sub btnBrowse_Click(ByVal sender As System.ObjectByVal e As System.EventArgs)             
          
Handles btnBrowse.Click

         
'select a image and get the path
        Dim dlg As OpenFileDialog = New OpenFileDialog

        dlg.Filter = "Image Files (*.bmp, *.gif, *.jpg)|*.bmp;*.gif;*.jpg"
        dlg.Title = "Select the image to load."

        dlg.ShowDialog()

        '
put the selected image in the picturebox to see it
        pic
.Image Image.FromFile(dlg.FileName)
        
dlg.Dispose()

    
End Sub
End 
class 
http://www.devx.com/tips/Tip/21380
__________________
PD: Con amor, fe, amor a Dios y amistad podemos hacer un mundo mejor!!!!