;Autor: Hroudtwolf EnableExplicit Define a Structure tCBGEX hBackgroundBrush .i nFrontColor .i *oProc EndStructure Procedure _CBGExCB ( hWnd.i , idMsg.i , wParam.i , lParam.i ) Protected *CBGEx.tCBGEX = GetProp_( hWnd , "CBGEXDATA" ) Select idMsg Case #WM_CTLCOLOREDIT , #WM_CTLCOLORLISTBOX SetBkMode_( wParam , #TRANSPARENT ) SetTextColor_( wParam , *CBGEx\nFrontColor ) ProcedureReturn *CBGEx\hBackgroundBrush Case #WM_DESTROY DeleteObject_( *CBGEx\hBackgroundBrush ) SetWindowLongPtr_( hWnd , #GWL_WNDPROC , *CBGEx\oProc ) FreeMemory ( *CBGEx ) EndSelect ProcedureReturn CallWindowProc_( *CBGEx\oProc , hWnd.i , idMsg.i , wParam.i , lParam.i ) EndProcedure Procedure.i ComboBoxGadgetEx ( idGadget.i , nX.i , nY.i , nWidth.i , nHeight.i , btFlags.i = #Null ) Protected nResult .i Protected hWnd .i Protected *CBGEx .tCBGEX nResult = ComboBoxGadget ( idGadget , nX , nY , nWidth , nHeight , btFlags ) If Not nResult ProcedureReturn #Null EndIf If idGadget = #PB_Any hWnd = GadgetID ( nResult ) Else hWnd = GadgetID ( idGadget ) EndIf *CBGEx = AllocateMemory ( SizeOf ( tCBGEX ) ) *CBGEx\oProc = GetWindowLongPtr_( hWnd , #GWL_WNDPROC ) *CBGEx\nFrontColor = GetSysColor_( #COLOR_BTNTEXT ) *CBGEx\hBackgroundBrush = CreateSolidBrush_( GetSysColor_( #COLOR_WINDOW ) ) SetProp_( hWnd , "CBGEXDATA" , *CBGEx ) SetWindowLongPtr_( hWnd , #GWL_WNDPROC , @ _CBGExCB () ) InvalidateRect_( hWnd , #Null , #True ) ProcedureReturn nResult EndProcedure Procedure.i ComboBoxGadgetEx_Color ( idGadget.i , nMode.i , nColor.i ) Protected *CBGEx.tCBGEX Protected hWnd If IsGadget ( idGadget ) *CBGEx = GetProp_( GadgetID ( idGadget ) , "CBGEXDATA" ) If Not *CBGEx ProcedureReturn #False EndIf Select nMode Case #PB_Gadget_BackColor DeleteObject_( *CBGEx\hBackgroundBrush ) *CBGEx\hBackgroundBrush = CreateSolidBrush_( nColor ) Case #PB_Gadget_FrontColor *CBGEx\nFrontColor = nColor Default ProcedureReturn #False EndSelect InvalidateRect_( hWnd , #Null , #True ) ProcedureReturn #True EndIf ProcedureReturn #False EndProcedure If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) ComboBoxGadgetEx(1,10,10,480,20,0) For a=1 To 10 AddGadgetItem(1,-1,"Testitem "+Str(a),0,0) Next SetGadgetState(1,0) ComboBoxGadgetEx_Color(1,#PB_Gadget_BackColor,RGB(50,50,255)) ComboBoxGadgetEx_Color(1,#PB_Gadget_FrontColor,RGB(200,200,255)) Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow EndIf