문제

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