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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top