Hintergrund eines Tabcontrols transparent machen



  • Ich hab mal im MSDN nachgeschaut, aber es gibt nur folgende Nachrichten, die gesendet werden:

    WM_CTLCOLORBTN
    WM_CTLCOLOREDIT
    WM_CTLCOLORDLG
    WM_CTLCOLORLISTBOX
    WM_CTLCOLORSCROLLBAR
    WM_CTLCOLORSTATIC

    Keine für Tabcontrols.

    Hier mal ein Beispielbild:

    http://img254.imageshack.us/img254/6629/tabcr1.png

    Der graue Balken am oberen Rand sollte transparent sein.
    Vielen Dank im Voraus für eure Hilfe.



  • Is zwar net die beste lösung aber must du selber weg zeichnen bsp mit SubClassing

    [cpp]
    WNDPROC g_pfnTab;
    //..
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    LRESULT CALLBACK    SubclassTabProc(HWND,UINT,WPARAM ,LPARAM );
    //..
    LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
    {
      switch(uiMsg)  
      {
    //..
    hTab = CreateWindow(WC_TABCONTROL,TEXT(""),
                        WS_VISIBLE | WS_CLIPSIBLINGS | 
                        WS_CHILD | WS_EX_TRANSPARENT ,
          		  20, 20, 350, 300,
      		 hWnd, 0, hInst, NULL);
    //..
    g_pfnTab = reinterpret_cast<WNDPROC>(SetWindowLongPtr(hTab/*Dein TabCtrl*/,GWL_WNDPROC,reinterpret_cast<LONG_PTR>(SubclassTabProc)));
    //..
    LRESULT CALLBACK SubclassTabProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
    {
    	COLORREF     TabBGColor    = RGB(255,255,255),
    	             TabTextColor  = RGB(0,0,0);
    
    	if (uMsg==WM_PAINT)
    	{
    		LRESULT l = CallWindowProc(g_pfnTab,hwnd,uMsg,wParam,lParam);
    
    		HDC hdc = GetDC(hwnd);
    		COLORREF cr = GetSysColor(COLOR_BTNFACE);
    		SelectObject(hdc,g_hbrBkgnd);
    		RECT r;
    		GetClientRect(hwnd,&r);
    		ExtFloodFill(hdc,r.right-3,3,cr,FLOODFILLSURFACE);
    		SelectObject(hdc,GetStockObject(WHITE_BRUSH));
    		ReleaseDC(hwnd,hdc);
    		return l;
    	}
    	return CallWindowProc(g_pfnTab,hwnd,uMsg,wParam,lParam);
    }[/cpp]
    

    aja wenn einer ne bessere lösung bitte Posten wüste sie auch gern 😃
    MFG Ascharan



  • Danke für deine Hilfe. 🙂
    Ich werde erstmal deine Methode verwenden.


Anmelden zum Antworten