Question

I'm using checkbox buttons and I want to make the button expand in width when I click it using LBUTTONDOWN

Would this involve using something like AppendMenu()? If so, how would I do it?

This is what I have so far for my button proc:

LRESULT CALLBACK ButtonWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM     lParam){
    static int x,y,btnwidth, btnheight;
    switch (message){
        case WM_USER:
            btnwidth=wParam;
            btnheight=lParam;
            return 0;
        case WM_LBUTTONDOWN:
            btnwidth *= 2;
            break;
    }
Was it helpful?

Solution

You can expand the button by calling MoveWindow. You probably will want to first call GetWindowRect to get the current size and position, and then ScreenToClient to convert the rect to client coordinates. Then you can adjust the client coordinates as you wish and pass them to MoveWindow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top