DButton Design

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 :slight_smile:

I had the same struggle, here is what I did once:


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





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


basically this will make the button hover when your cursor is hovering over it

Panel:IsHovered