• DButton SetColor
    5 replies, posted
I've tried about every way to set the color of this DButton, nothing seems to change the color. I've even done Paint functions. [lua] local DButton3 = vgui.Create("DButton", DPanel1) DButton3:SetPos(15, 40) DButton3:SetText(_Talk1) DButton3:SetTextColor(Color(0, 0, 200, 255)) DButton3:SizeToContents() DButton3.DoClick = function() DPanel1:Close() end [/lua]
I don't think you can set the colour of a regular derma button, you have to use the [B]Paint[/B] function and draw a coloured rectangle or something similar. [editline]EDIT[/editline] You [I]can [/I]use the paint function with a button, i've just tried it ingame, post the code you used when you tried to paint the button.
[lua] DButton3.Paint = function() draw.SimpleText(_Talk1, "UIBlod", 15, 40, Color(0, 0, 200, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end [/lua]
The code works fine in my game, what are you trying to do? Change the text colour or the button colour?
try this :D local DColorButton = vgui.Create( "DColorButton", DFrame ) DColorButton:SetPos( 1, 28 ) DColorButton:SetSize( 100, 30 ) DColorButton:Paint( 100, 30 ) DColorButton:SetText( " DColorButton" ) DColorButton:SetColor( Color( 0, 110, 160 ) )
EDIT: Wait, just saw this post is really old.
Sorry, you need to Log In to post a reply to this thread.