Home > Software engineering >  [control] PictureBox properties of doubt
[control] PictureBox properties of doubt

Time:10-01

I found in the process of testing:
If create a PictureBox, directly using the
Bitblt API function will be in his drawing above:
As follows:
 
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Sub Command1_Click ()
Picture2. AutoRedraw=True 'here will AutoRedraw is set to True, you can open a memory mapping buffer
BitBlt Picture2. HDC, 0, 0, 300, 300, Picture1. HDC, 0, 0, vbSrcCopy 'by mapping to the buffer, and no written PictureBox
Picture2. Refresh 'precipitate the contents of the buffer to the PictureBox
Picture2. AutoRedraw=False 'ban data written in the picture box and
End Sub


The picture box after the obstructed by other Windows, can be redrawn properly, keep I use Bitblt map of,

But, if I use the Picture1. Picture=LoadPicture (file path) this way for a PictureBox images

Using Bitblt draw figure can't keep up, don't know why,

CodePudding user response:

Autoredraw is set to true, in fact is for window to create a memory buffer, can save the background because memory buffer copy into the window of the cache area at any time, but the bitblt HDC is copied to the real video, so you can't save

You can try:
Private Sub Command1_Click ()
Picture2. AutoRedraw=false 'here will AutoRedraw is set to true, you can open a memory mapping buffer BitBlt Picture2. HDC, 0, 0, 300, 300, Picture1. HDC, 0, 0, vbSrcCopy' image map to the buffer, not write PictureBox Picture2. Refresh 'precipitation to the contents of the buffer to the PictureBox Picture2. AutoRedraw=true' according to ms said, this kind of treatment will copy into the memory physical hDC hDC
End Sub


CodePudding user response:

Dizzy, as if to say wrong, you have a look at this, written before
http://blog.csdn.net/worldy/article/details/7381106

CodePudding user response:

This problem I will thoroughly tested over a period of time!

CodePudding user response:

reference greatbody reply: 3/f
this problem I will thoroughly tested over a period of time!


Still haven't finished the test, hurriedly junction post oh:)

CodePudding user response:

reference 4 floor bcrun response:
Quote: reference greatbody reply: 3/f

This problem I will thoroughly tested over a period of time!


Still haven't finished the test, and post quickly oh:)
not yet, wait,
  • Related