graphics - Double-Buffering VB6 with BitBlt help -


EDIT: I'm updating version 2. Now it's monochrome. I'm sure not try to fix it by making the CreateCOmpatibleBitmap calls with DC window than Memdc (in writing), but it is still wrong: (

the versions of the 3 different actions are simplified I wrote. version 1 is fully (but flicker works, of course), version 2 does nothing, and version 3 Black Fill the whole form together. Movie 2? Is set to Scalemode vbPixels wrong.

Version 1:

  private sub Form_Paint () Me.Cls DrawStuff Me.hDc End Sub  < /> 

version 2 (new) pre:

  private sub Form_Paint () Me.Cls if m_HDCmem = 0 then m_HDC = GetDC (hwnd) m_HDCmem = CreateCompatibleDC (m_HDC) m_HBitmap = CreateCompatibleBitmap (M_HDC, Me.ScaleWidth, Me.ScaleHeight) ReleaseDC faucet, m_HDC SelectObject m_HDCmem, m_HBitmap end then drawStuff m_HDCmem Debug.Print bitblt (Me.hDc, 0, 0, Me.ScaleWidth, Me.ScaleHeight, m_HDCmem, 0, 0, SRCCOPY) 'during the test, printed "1" m. Refresh and sub  

version 3:

  private sub form_Paint () Me.Cls if m_HDC = 0 then m_HDC = CreateCompatibleDC (Me.hDc) DrawStuff m_HDC BitBlt (Me.hDc, 0, 0, during Me.ScaleWidth, Me.ScaleHeight, m_HDC, 0, 0, blackish) test, the printed "1" Me.Refresh End Sub  
< P> Note: I had pasted the code in my resizing function immediately after coloring the color. It does not help, but I am pretty sure I should leave it there:

  If m_HDC & lt; & Gt; 0 then deleteDC m_HDC m_HDC = 0  

version 2 & amp; 3 Krendisi your Compraijet to call () creates a monochrome drawing surface which is 1 pixel by 1 pixel. You need to call CreateCompatibleBitmap () somewhere.

View


Comments