VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code completly paints the screen with the picture file of your choice

by Ishwar Purushotham (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 24th December 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code completly paints the screen with the picture file of your choice

API Declarations



'you need to have 2 picture boxes, if you want to load a picture
' on the screen
'==================== By Ishwar Purushotham =====================

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40

Dim hTaskb As Long


Rate This code completly paints the screen with the picture file of your choice



 Form1.Height = Screen.Height
 Form1.Width = Screen.Width
  
  ' i have been having problems with the following code. try it,
  'if it does not work, manually set properties
  Form1.MaxButton = False
  Form1.MinButton = False
  Form1.WindowState = vbMaximized


'you can choose the Form's borderstyle to 0-none,
'if you want to paint the whole screen

   'Hide the taskbar
   hTaskb = FindWindow("Shell_traywnd", "")
   Call SetWindowPos(hTaskb, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
 
      Picture1.AutoRedraw = True: Picture2.AutoRedraw = True
      Picture1.AutoSize = True
      Picture1.Appearance = 0:  Picture2.Appearance = 0
      Picture1.BorderStyle = 0: Picture2.BorderStyle = 0

 
 With Picture1
   .Picture = LoadPicture("The path of the file ")
 Picture2.Width = Screen.Width
 Picture2.Height = Screen.Height
 Picture2.PaintPicture .Picture, 0, 0, Screen.Width, Screen.Height, 0, 0, .Width, .Height
End With
 
     Picture2.Left = Form1.Left
 Picture2.Top = Form1.Top
 
End Sub


Private Sub Form_Unload(Cancel As Integer)
   'show the the taskbar
   Call SetWindowPos(hTaskb, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub




Download this snippet    Add to My Saved Code

This code completly paints the screen with the picture file of your choice Comments

No comments have been posted about This code completly paints the screen with the picture file of your choice. Why not be the first to post a comment about This code completly paints the screen with the picture file of your choice.

Post your comment

Subject:
Message:
0/1000 characters