Jump to content
Sign in to follow this  
Clerythecleric

GUITab remove the overlay bit? (see pic)

Recommended Posts

Clerythecleric

Hello,

 

Can someone tell me please how to remove this like background part of the tab? I added a snippet from another post so that i can color the tab backgrounds but now I have this? Before it had a white background which i could hide but since changing the style its like the tabs  aer being cut off at the bottom. Any help appreciated thank you.

Tab.png

;Constants
Global Const $ODT_TAB = 101
Global Const $ODS_SELECTED          = 0x0001
Global Const $ODA_DRAWENTIRE = 0x1
Global Const $ODS_FOCUS             = 0x0010

;Tab Creation
$hTab = GUICtrlCreateTab(5, 0, 280, 0, $TCS_OWNERDRAWFIXED)

;Color change
Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    Local $DRAWITEMSTRUCT

    $DRAWITEMSTRUCT = DllStructCreate("uint cType;uint cID;uint itmID;uint itmAction;uint itmState;" & _
                                  "hwnd hItm;hwnd hDC;dword itmRect[4];dword itmData", $lParam)

    If DllStructGetData($DRAWITEMSTRUCT, "cType") <> $ODT_TAB Then Return $GUI_RUNDEFMSG

    Local $cID = DllStructGetData($DRAWITEMSTRUCT, "cID")
    Local $itmID = DllStructGetData($DRAWITEMSTRUCT, "itmID")
    Local $itmAction = DllStructGetData($DRAWITEMSTRUCT, "itmAction")
    Local $itmState = DllStructGetData($DRAWITEMSTRUCT, "itmState")
    Local $hItm = DllStructGetData($DRAWITEMSTRUCT, "hItm")
    Local $hDC = DllStructGetData($DRAWITEMSTRUCT, "hDC")

    If $itmAction <> $ODA_DRAWENTIRE Then Return $GUI_RUNDEFMSG

    Local $iTextColor, $itmText

    Switch $itmID
    Case 0
               if $test1 = 1 Then
            $iBrushColor = 0xFC3C3C
         Else
            $iBrushColor = 0x949191
         EndIf

        Case 1
               if $test2 = 1 Then
            $iBrushColor = 0xFC3C3C
         Else
            $iBrushColor = 0x949191
         EndIf

      Case 2
               if $test3 = 1 Then
            $iBrushColor = 0xFC3C3C
         Else
            $iBrushColor = 0x949191
         EndIf

      Case 3
            if $test4 = 1 Then
            $iBrushColor = 0xFC3C3C
         Else
            $iBrushColor = 0x949191
         EndIf

    EndSwitch

    DLLCall("gdi32.dll","int","SetBkMode", "hwnd", $hDC, "int", 1)

    Local $iBrush = DLLCall("gdi32.dll","hwnd","CreateSolidBrush", "int", $iBrushColor)
    $iBrush = $iBrush[0]

    Local $iBrushOld = _WinAPI_SelectObject($hDC, $iBrush)

    DLLCall("user32.dll","int","FillRect", "hwnd", $hDC, "ptr", DllStructGetPtr($DRAWITEMSTRUCT, "itmRect"), "hwnd", $iBrush)

    Local $tBuffer = DllStructCreate("char[256]")
    DllStructSetData($tBuffer, 1, "Item" & $itmID)
    $itmText = DllStructGetData($tBuffer, 1)

    DllStructSetData($DRAWITEMSTRUCT, "itmRect", DllStructGetData($DRAWITEMSTRUCT, "itmRect", 1) + 10, 1)
    DllStructSetData($DRAWITEMSTRUCT, "itmRect", DllStructGetData($DRAWITEMSTRUCT, "itmRect", 2) + 5, 2)

    DllCall("user32.dll", "int", "DrawText", "hwnd", $hDC, "str", $itmText, "int", StringLen($itmText), _
            "ptr", DllStructGetPtr($DRAWITEMSTRUCT, "itmRect"), "int", $DT_LEFT)

    _WinAPI_SelectObject($hDC, $iBrushOld)
    _WinAPI_DeleteObject($iBrush)

    Return $GUI_RUNDEFMSG
EndFunc
Edited by Clerythecleric

Share this post


Link to post
Share on other sites
spudw2k

It would be nice if you could update your post with a working example, it's missing includes and I have no idea what the $test variables should be set to and/or if they are related to the issue you are trying to solve.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×