Question

In using WTL/ATL/ Windows API, I have created a window dialog with buttons and a listview, I want to apply some styles I have received as images, also roud courners, I have read about owner drawn..custom drawn and other stuff but I can't find an example, I have tried:

 LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
     {
            HDC hdc;

            RECT rect = {0};
            PAINTSTRUCT ps;
            rect.top = 100;
            rect.right = 100;
            rect.bottom = 100;
            hdc = BeginPaint( &ps);

            ::FillRect(hdc, &rect, (HBRUSH)(COLOR_BTNFACE + 1));

            EndPaint( &ps);
         return 0;
 }

It doesn't show anything on the dialog.

Was it helpful?

Solution

Your code:

      rect.top = 100;
      rect.bottom = 100;

What do you expect? You are filling zero height rectangle and expectedly you don't see anything. The rest of the code is correct and is going to start working as soon as you fix rectangle.

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