I would use the base function for DListView_Line paint. You can find it here at line 33. Unfortunately, the line is painted with a derma_hook, or a derma skin, so you will have to look into how the default derma skin paints the line.
The line is complicated, obviously. There is the selected color, the deselected color, the regular color, and the every-other color. I would just copy the current derma skin and modify the colors there.
You could also try Line:SetColor() but I assume you already did that and it probably didn’t work.
if you want to color all lines then its something like this:
for k,v in pairs(player.GetAll()) do
DListView:AddLine( ) --what ever you want to add
DListView:GetLine(k).Paint = function()
-- what you want to paint EXAMPLE:
-- draw.RoundedBox(0,0,0, DListView:GetWide(), DListView:GetTall(), Color(249,105,14,255)) -- this will make every line Orange.
If you still need it or not I decided to put it here so maybe someone in near future could be looking for this
I realize this is a bump as well, but this might be helpful for anyone working with the DListView.
PANEL:Paint( w, h ) automatically gives you the width and height parameters. You don’t need to use :GetWide() and :GetTall().
If you want to override the paint hooks of an already existing DListView panel, you can also do something along these lines:
for _, line in pairs( YourDListView:GetLines() ) do
function line:Paint( w, h )
if ( self:IsHovered() ) then
-- draw it highlighted
elseif ( self:IsSelected() ) then
-- draw it selected
elseif ( self:GetAltLine() ) then
-- draw it lighter or darker
-- draw it normally
-- if you want to change the text font/color of the columns
for _, column in pairs( line["Columns"] ) do
column:SetFont( "YourFont" )
column:SetTextColor( YourColor )
You can also color the column tabs at the top:
for _, v in pairs( YourDListView[ "Tabs" ] ) do
function v.Header:Paint( w, h )
-- paint it how you want
v.Header:SetFont( "YourFont" )
v.Header:SetTextColor( YourColor )
Finally, you can also change the look of the vertical scroll bar so it fits your theme:
function YourDListView.VBar:Paint( w, h )
-- paints the track area behind the grip and the buttons
function YourDListView.VBar.btnUp:Paint( w, h )
-- paints the top button that lets you scroll up
function YourDListView.VBar.btnDown:Paint( w, h )
-- paints the bottom button that lets you scroll down
function YourDListView.VBar.btnGrip:Paint( w, h )
-- paints the portion of the scrollbar that you can grab
With those functions overwritten, you can produce something like: