I am drawing a tabstrip onto an MDI client area, and subclassing to catch the WM_NCCALCSIZE message and altering the client area to give myself some room at the top to draw the tab strip. However, when it comes to actually drawing the tabstrip, I am stuck... I am trying to BitBlt from a picturebox on to the "off-limits" area I have just created, but no success (Nothing gets drawn). However drawing on to the rest of the client area works perfectly.

Maybe some code would help, this is the WndProc code which shows the client area size adjustment (which works) and the BitBlt (which doesn't)
VB Code:
  1. Private Function WndProc( _
  2.     ByVal hWnd As Long, _
  3.     ByVal uMsg As Long, _
  4.     ByVal wParam As Long, _
  5.     ByVal lParam As Long _
  6. ) As Long
  7.  
  8. Dim udtNCCalcSize   As NCCALCSIZE_PARAMS
  9. Dim udtWndPos       As WINDOWPOS
  10. Dim udtWndRect      As RECT
  11. Dim udtPicBoxRect   As RECT
  12. Dim lhDC            As Long
  13.  
  14.     Select Case uMsg
  15.         Case WM_NCCALCSIZE
  16.  
  17.             ' Adjust the client area size calculation to allow for our tabstrip
  18.  
  19.             If (wParam <> 0) Then
  20.                 RtlMoveMemory udtNCCalcSize, _
  21.                               ByVal lParam, _
  22.                               Len(udtNCCalcSize)
  23.  
  24.                 RtlMoveMemory udtWndPos, _
  25.                               ByVal udtNCCalcSize.lppos, _
  26.                               Len(udtWndPos)
  27.  
  28.                 With udtNCCalcSize.rgrc(0)
  29.                     .Left = udtWndPos.x + 2
  30.                     .Top = udtWndPos.y + MAGICNUMBER
  31.                     .Right = (udtWndPos.x + udtWndPos.cX) - 2
  32.                     .Bottom = (udtWndPos.y + udtWndPos.cY) - 2
  33.                 End With
  34.  
  35.                 LSet udtNCCalcSize.rgrc(1) = udtNCCalcSize.rgrc(0)
  36.  
  37.                 RtlMoveMemory ByVal lParam, _
  38.                               udtNCCalcSize, _
  39.                               Len(udtNCCalcSize)
  40.  
  41.                 WndProc = WVR_VALIDRECTS
  42.  
  43.               Else
  44.                 WndProc = CallWindowProc(mlpfnOldWindowProc, _
  45.                                          hWnd, _
  46.                                          uMsg, _
  47.                                          wParam, _
  48.                                          lParam)
  49.             End If
  50.  
  51.         Case WM_PAINT, WM_NCPAINT
  52.             GetWindowRect hWnd, udtWndRect
  53.             GetWindowRect mobjDrawPicBox.hWnd, udtPicBoxRect
  54.  
  55.             DrawGradient GradientColorEnd, _
  56.                          GradientColorStart, _
  57.                          GRADIENT_DRAW_VERTICAL, _
  58.                          MAGICNUMBER, _
  59.                          udtWndRect.Right - udtWndRect.Left
  60.  
  61.             lhDC = GetDC(hWnd)
  62.  
  63.             BitBlt lhDC, 0, _
  64.                          (-MAGICNUMBER), _
  65.                          udtWndRect.Right - udtWndRect.Left, _
  66.                          MAGICNUMBER, _
  67.                    mobjDrawPicBox.hDC, _
  68.                          0, _
  69.                          0, _
  70.                          vbSrcCopy
  71.  
  72.             ReleaseDC hWnd, lhDC
  73.  
  74.             WndProc = CallWindowProc(mlpfnOldWindowProc, _
  75.                                      hWnd, _
  76.                                      uMsg, _
  77.                                      wParam, _
  78.                                      lParam)
  79.  
  80.         Case Else
  81.             WndProc = CallWindowProc(mlpfnOldWindowProc, _
  82.                                      hWnd, _
  83.                                      uMsg, _
  84.                                      wParam, _
  85.                                      lParam)
  86.     End Select
  87. End Function

MAGICNUMBER = 23.
Bear in mind that BitBlt'ing to a y value > 0 works, but I need it to be absolute 0, i.e. adjusted top of client area minus adjustment offset. Above this point nothing is drawn, it just picks up bits from the rest of the screen when I resize the window (not refreshing effect).

Any ideas?