Private Sub Form_Load ()
RTN=GetWindowLong (Hwnd, GWL_EXSTYLE)
RTN=RTN Or WS_EX_LAYERED
GWL_EXSTYLE SetWindowLong Hwnd, RTN
SetLayeredWindowAttributes Hwnd, & amp; HFF& , 120, LWA_COLORKEY 'this part is to dig the transparent, can skip
Picture1. Move 0, 0, Form1. Width, Form1. Height
Timer1. Interval=1000
End Sub
Private Sub Form_Resize ()
Picture1. Move 0, 0, Form1. Width, Form1. Height 'control to adapt to changes in window after
End Sub
Private Sub Timer1_Timer ()
Dim wScreen As Long
Dim hScreen As Long
Dim w As Long
Dim h As Long
Dim x, y, As Long
Picture1. Refresh
X=Form1. Left/15
Y=Form1. Top/15
Picture1. ScaleMode=3
W=Picture1. Width
H=Picture1. Height
HdcScreen=GetDC (0)
StretchBlt Picture1. HDC, 0, 0, w, h, hdcScreen, 8 + x, 30 + y, w, h, vbSrcCopy
StretchBlt Picture1. HDC, 0, 0, w, h, Picture1. HDC, 0, 0, w, h, vbDstInvert
End Sub
Declaration section is not posted, form only a picturebox and a timer
CodePudding user response:
Why should constantly refresh? Visual you can paint the bitmap in memory, and then bind to the PictureBox Picture properties, make it automatic stretch and re-paint,CodePudding user response: