Quote
Dear Paolo wrote:
> Button is a window CreateWindow() with button style.
> Image may be load with LoaImage() and drawed directly in the window DC
> GetDC(), BitBlt(), ReleaseDC().
> In order to respond at the windows messages i.e. WM_SIZE, WM_MOVE, etc you
> have to send windows messages to the created window with SendMessage(), or
> call MoveWindow() to move and size.
> Ciao.
Thanks~ I can paint some photo to window, but I still have some question.
I can't both have the event that move the window and click the window.
It'll just trigger the click event.
I want to move a child window and to click it sometime.
my code as following:
And how to show solid button on the main window, not just a child window.
It'll be repainted when the child window be covered, and the photo will be
clear.
I want to repaint it, but I don't know how to do it.
LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
lParam) {
switch(msg) {
case WM_NCHITTEST: //sent to a window when the cursor moves
if ( hWnd==hWnd2) // the hWnd2 is the windows of
button
{
TRect rect;
GetWindowRect(hWnd2, &rect);
HDC hDC=GetWindowDC(hWnd2);
StretchBlt(hDC,0,0,rect.Width(),rect.Height(),
ImageBuffer->Canvas->Handle,0,0,ImageBuffer->Picture->Width
,ImageBuffer->Picture->Height , SRCCOPY );
::ShowWindow(hWnd2, SW_SHOWNORMAL);
::UpdateWindow(hWnd2);
ReleaseDC(hWnd2,hDC);
}
return HTCAPTION;
case WM_MOVING:
return 0;
case WM_LBUTTONDBLCLK :
ShowMessage("click");
return 0;
case WM_SIZE:
//SendMessage(hWnd,WM_SIZE,wParam,lParam);
////////////////////It's error, I don't know why it is.
// }
}
Thanks~
David