ComboBox Option Painting

Hi,

I haven’t been able to find out how anywhere so I figured I’d ask…

Is there a way to paint the options inside of a ComboBox? Background color, mouse hover color, text color, etc?

Bump. Anyone?

You can view the source code for vgui elements here: https://github.com/garrynewman/garrysmod/tree/master/garrysmod/lua/vgui

Looks like dcombobox creates a DermaMenu, which uses DMenu, which creates a DMenuOption when AddOption is called on it.

So just override DMenuOption’s paint function

Thank you! That’s exactly what I needed!

Just in case anyone else needs help with this, put the below code into your ComboBox option loop.



function DMenuOption:Paint(w, h)
	draw.RoundedBox(0, 0, 0, w, h, Color(100, 0, 0, 200))
end