• DLabel sizing
    2 replies, posted
Hello. Somewhat new in lua, and couldn't find a solution on the wiki for this. In my Derma Panel, I have a DLabel that says the player's name, and I have colored it alongside a font. Problem is, my name is Camben, and when shown on the panel, it says "Cam..." Of course this can be fixed by simply reducing my custom font's size, but I don't want small ass words. I just want it to be big and readable. Thanks for any help. If anyone needs it or anything; local Frame = vgui.Create( "DFrame" ) Frame:SetPos( 700, 300 ) Frame:SetSize( 500, 500 ) Frame:SetTitle( "Moderator Tools" ) Frame:SetVisible( true ) Frame:SetDraggable( true ) Frame:ShowCloseButton( true ) Frame:MakePopup() Frame.Paint = function( self, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 16, 59, 127, 255 ) ) draw.RoundedBox( 80, 80, 80, w, h, Color( 16, 59, 150, 255 ) ) end local ply = LocalPlayer() surface.CreateFont( "playerNameFont", { font = "Tahoma", size =  ScreenScale( 7.6666 ), weight = 50 } ) surface.CreateFont( "topFont", { font = "Tahoma", size =  ScreenScale( 10 ), weight = 50 } ) local DLabel = vgui.Create( "DLabel", Frame) DLabel:SetPos(10,100) DLabel:SetFont("playerNameFont") DLabel:SetColor( Color(249, 9, 201)) DLabel:SetText(ply:Name()) local DLabel = vgui.Create( "DLabel", Frame) DLabel:SetPos(260,50) DLabel:SetFont("topFont") DLabel:SetColor( Color(255, 255, 255)) DLabel:SetFont("topFont") DLabel:SetText("Moderator Tools") end)
Use Panel/SizeToContents or SetSize manually
Awesome! SizeToContents worked, thank you!
Sorry, you need to Log In to post a reply to this thread.