Copy the Desktop Wallpaper to your Form's Background
Its simple to copy the desktop wallpaper to your form's background or to any
control with a device context handle (such as a picture box). All it
takes is a single line of code which calls the PaintDesktop
API.
Download Source Code
Copy the following code to the Declarations section of a Form:
Private Declare Function PaintDesktop Lib "user32" (ByVal hdc As Long) As Long
Copy the following code to the Form's Paint Event:
'
' The PaintDesktop function fills the clipping region in the specified
' device context with the desktop pattern or wallpaper. The
' function is provided primarily for shell desktops.
'
Private Sub Form_Paint()
PaintDesktop Me.hdc
End Sub
'
' The PaintDesktop function fills the clipping region in the specified
' device context with the desktop pattern or wallpaper. The
' function is provided primarily for shell desktops.
'
Private Sub Form_Paint()
PaintDesktop Me.hdc
End Sub
Download this project and run it. Resize the form to better view the
wallpaper which was added to the form's background.
|
About TheScarms
Sample code version info
|