Search Amazon:

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

Form 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

 

Instructions

Download this project and run it. Resize the form to better view the wallpaper which was added to the form's background.

Sign In
  User Id 
  Password 


Submit Your Own Code and Articles




About TheScarms
About TheScarms

Ask me your programming questions

I read every email and answer all I can.

User Feedback: Be the first to add a comment! Items to Show:     

     
You must log in to post feedback.
Comment:    
 

If you use this code, please mention "www.TheScarms.com"

Email this page


TheScarms AppSentinel lets you securely copy protect and create evaluation versions of your software

TheScarms(tm) AppSentinel lets you quickly and easily create evaluation versions of your software and stop unauthorized copying and unregistered use of your programs!

Get your free
trial copy today!


      The World's Number 1 Web Host

© Copyright 2008 TheScarms