Hello everyone!
I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.
I have made a tree view control in dialog box, using resource editor.
Tree view also has images, lines and buttons.
I just need instructions on how to make it's background transparent.
Tree's nodes also should have transparent background.
I think that I should use custom draw for this, but I am not very experienced, that is why I ask for help.
Code example, or snippet would be very helpful, but I would also appreciate written instructions as well, but make them detailed please, since I am not very experienced.
I work in MS Visual Studio Express 2008, on Windows XP, in C++, using
pure WIN32 API.
That would be all, again I thank everyone who tries to help.Thank you very very much!
EDIT #1:
------------------------------
I have tried subclassing the tree view, and got it to have transparent background, but tree's items don't show.
I am posting the code of the subclassing procedure here in hope that someone can help me with some advice:
LRESULT CALLBACK wpTree(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps),
hdcMem = CreateCompatibleDC(hdc);
RECT r;
GetClientRect( hWnd, &r );
HBITMAP bmp = CreateCompatibleBitmap( hdcMem,
r.right - r.left, r.bottom - r.top ),
bmpOld;
bmpOld = (HBITMAP)SelectObject( hdcMem, bmp );
TransparentBlt( hdc, 0, 0, r.right - r.left,
r.bottom - r.top, hdcMem, 0, 0,
r.right - r.left,
r.bottom - r.top,
RGB( 0, 0, 0 ) );
SelectObject( hdcMem, bmpOld );
DeleteObject(bmp);
DeleteDC(hdcMem);
EndPaint(hWnd, &ps);
}
return 0L;
case WM_ERASEBKGND:
return 0L;
}
return CallWindowProc( wp, hWnd, message, wParam, lParam );
}