local PANEL = {} local base = vgui.GetControlTable("DLabel") setmetatable(PANEL,{__index=base}) --Function stolen from the lua wiki function draw.TextRotated( text, x, y, color, font, ang ) render.PushFilterMag( TEXFILTER.ANISOTROPIC ) render.PushFilterMin( TEXFILTER.ANISOTROPIC ) surface.SetFont( font ) surface.SetTextColor( color ) surface.SetTextPos( 0, 0 ) local textWidth, textHeight = surface.GetTextSize( text ) local rad = -math.rad( ang ) x = x - ( math.cos( rad ) * textWidth / 2 + math.sin( rad ) * textHeight / 2 ) y = y + ( math.sin( rad ) * textWidth / 2 + math.cos( rad ) * textHeight / 2 ) local m = Matrix() m:SetAngles( Angle( 0, ang, 0 ) ) m:SetTranslation( Vector( x, y, 0 ) ) cam.PushModelMatrix( m ) surface.DrawText( text ) cam.PopModelMatrix() render.PopFilterMag() render.PopFilterMin() end function PANEL:Paint(w,h) local x,y = self:LocalToScreen(0,0) print("x",x,"y",y) draw.TextRotated(self:GetText(),0,y,Color(0,0,0,255),"DermaDefault",-45) end function PANEL:GetHeaderHeight() return 0--10 * #(self.Header:GetText()) end function PANEL:Init() --self.Header = vgui.Create( "DButton", self ) --self.Header.DoClick = function() self:DoClick() end --self.Header.DoRightClick = function() self:DoRightClick() end end vgui.Register("DTiltedLabel", PANEL, "DLabel")