Text auf Button wird nicht ausgegeben (BS_OWNERDRAW)



  • LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
    {
        static BITMAP bitmap; 
        static HBITMAP hBitmap; 
        HINSTANCE hInstance; 
    	static HWND hwndSmaller;
    	LPDRAWITEMSTRUCT pDis;
    	RECT rect;
         switch (message) 
         { 
         case WM_CREATE:
    		 {
    		  hwndSmaller=CreateWindow(TEXT("BUTTON"),0,
    									WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,
    									100,100,100,100,
    									hwnd,(HMENU)3000,hInstance,NULL);
    		  SendMessage(hwndSmaller,BM_SETIMAGE , (WPARAM) IMAGE_BITMAP, (LPARAM) hBitmap);
    
    		 }
              return 0 ; 
    	 case WM_DRAWITEM:
    		 {
    			pDis=(LPDRAWITEMSTRUCT)lParam;
    			DrawText(pDis->hDC, TEXT("A"), -1,&rect, DT_SINGLELINE|DT_CENTER|DT_VCENTER);
    		 }
    


  • Und was ist deine Frage?

    Lies bitte das.

    p.s.: Schau dir mal den 4. Parameter von DrawText genau an...


Anmelden zum Antworten