|
-
Jul 26th, 2005, 12:56 PM
#1
[RESOLVED] How do I BitBlt onto an MDI client area when the client rect is adjusted?
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:
Private Function WndProc( _
ByVal hWnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long
Dim udtNCCalcSize As NCCALCSIZE_PARAMS
Dim udtWndPos As WINDOWPOS
Dim udtWndRect As RECT
Dim udtPicBoxRect As RECT
Dim lhDC As Long
Select Case uMsg
Case WM_NCCALCSIZE
' Adjust the client area size calculation to allow for our tabstrip
If (wParam <> 0) Then
RtlMoveMemory udtNCCalcSize, _
ByVal lParam, _
Len(udtNCCalcSize)
RtlMoveMemory udtWndPos, _
ByVal udtNCCalcSize.lppos, _
Len(udtWndPos)
With udtNCCalcSize.rgrc(0)
.Left = udtWndPos.x + 2
.Top = udtWndPos.y + MAGICNUMBER
.Right = (udtWndPos.x + udtWndPos.cX) - 2
.Bottom = (udtWndPos.y + udtWndPos.cY) - 2
End With
LSet udtNCCalcSize.rgrc(1) = udtNCCalcSize.rgrc(0)
RtlMoveMemory ByVal lParam, _
udtNCCalcSize, _
Len(udtNCCalcSize)
WndProc = WVR_VALIDRECTS
Else
WndProc = CallWindowProc(mlpfnOldWindowProc, _
hWnd, _
uMsg, _
wParam, _
lParam)
End If
Case WM_PAINT, WM_NCPAINT
GetWindowRect hWnd, udtWndRect
GetWindowRect mobjDrawPicBox.hWnd, udtPicBoxRect
DrawGradient GradientColorEnd, _
GradientColorStart, _
GRADIENT_DRAW_VERTICAL, _
MAGICNUMBER, _
udtWndRect.Right - udtWndRect.Left
lhDC = GetDC(hWnd)
BitBlt lhDC, 0, _
(-MAGICNUMBER), _
udtWndRect.Right - udtWndRect.Left, _
MAGICNUMBER, _
mobjDrawPicBox.hDC, _
0, _
0, _
vbSrcCopy
ReleaseDC hWnd, lhDC
WndProc = CallWindowProc(mlpfnOldWindowProc, _
hWnd, _
uMsg, _
wParam, _
lParam)
Case Else
WndProc = CallWindowProc(mlpfnOldWindowProc, _
hWnd, _
uMsg, _
wParam, _
lParam)
End Select
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|