Home > Software engineering >  [for help great god] how to avoid the picturebox scintillation caused by frequent refresh
[for help great god] how to avoid the picturebox scintillation caused by frequent refresh

Time:10-06

RT ~ for some reason need to be a part of the screen image color processing and display to the picture, but every 0.1 seconds a refresh keeps flashing white, don't know how to avoid, because it is a novice, so... How gdi not heard that double cache can solve, but vb6 don't know how to achieve it.. So I want to ask you how to avoid flash greatly white,,
 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:

reference 1st floor caozhy response:
why frequently refresh? Visual you can paint the bitmap in memory, and then bind to the PictureBox Picture properties, make it automatic stretch and re-paint,

I want to but because don't know how to contact with VB is not long time in the memory.. I had the idea is to cut to the figure in the memory and then after the color processing in the post in a picturebox.. But I don't know how to implement.

CodePudding user response:

 StretchBlt Picture1. HDC, 0, 0, w, h, Picture1. HDC, 0, 0, w, h, vbDstInvert 

Keep doing the operation of color, the purpose is not to flash,
  • Related