After 4 hours of trying to make a DButton look good, I just can't seem to make it right. Anyone have suggestions or a template/example I can work off. Thanks :)
I had the same struggle, here is what I did once:
[code]local button = vgui.Create( "DButton", panel )
button:SetText( "Label" )
button:SetPos( 50, 500 )
button:SetSize( 150, 50 )
button:SetTextColor( Color( 215, 215, 215 ) )
button.OnCursorEntered = function( panel )
panel.Hovered = true
end
[/code]
[code]button.OnCursorExited = function( panel )
panel.Hovered = false
end
button.PaintOver = function( panel, w, h )
surface.SetDrawColor( 215, 215, 215 )
surface.DrawOutlinedRect( 0, 0, w, h )
end
button.Paint = function( panel, w, h )
if panel.Hovered then
surface.SetDrawColor( 75, 75, 75 )
else
surface.SetDrawColor( 45, 45, 45 )
end
surface.DrawRect( 0, 0, w, h )
end
[/code]
basically this will make the button hover when your cursor is hovering over it