VGUI for all screen resolutions?

Is there anyway to make the VGUI fit for all screen resolutions. I made one on my 24 inch monitor that looked great, and then i switched to my 15 inch monitor and you cant even see whats happening.



self.TeamBackground = vgui.Create("DPanelList")			
	self.TeamBackground:EnableVerticalScrollbar(false) 										
	self.TeamBackground:SetSize((self.ToolPanel:GetWide() - 10), self.ToolPanel:GetTall())
	self.TeamBackground:SetPos(0, 0)
	self.TeamBackground.Paint = function()
		local Wide = self.TeamBackground:GetWide()
		local Height = self.TeamBackground:GetTall()
		local Join = "To join, click a team then click Join. To leave, click Leave"
		local Member = "Members Control Panel"
		surface.SetDrawColor(50, 50, 50, 255)	
		surface.DrawRect(0, 0, Wide, self.TeamBackground:GetTall())
		surface.SetTextColor(255, 255, 255, 255)
		
		surface.SetDrawColor( 102, 102, 102, 255 ) 
		surface.DrawRect(((self.TeamBackground:GetWide()*.05)), 10, ((self.TeamBackground:GetWide()*.9)), 230 )
		
		surface.SetFont("Trebuchet20")														
		local JoinW, JoinH = surface.GetTextSize(Join)
		surface.SetTextPos(((Wide*.5) - (JoinW*.5)), ((Height*.04) - (JoinH*.5)))	
		surface.DrawText(Join)
		
		surface.SetDrawColor( 102, 102, 102, 255 ) 
		surface.DrawRect(((self.TeamBackground:GetWide()*.05)), 260, ((self.TeamBackground:GetWide()*.9)), 280 )
		
		surface.SetFont("Trebuchet20")														
		local MemberW, MemberH = surface.GetTextSize(Member)
		surface.SetTextPos(((Wide*.5) - (MemberW*.5)), ((Height*.435) - (MemberH*.5)))	
		surface.DrawText(Member)
	end 
	
		local TeamSel = vgui.Create( "DComboBox", self.TeamBackground )
		TeamSel:SetPos(((self.TeamBackground:GetWide()*.15)), 50)	
		TeamSel:SetSize( 250, 175 )
		TeamSel:SetMultiple( false )	
		TeamSel:AddItem( "Red Team" )
		TeamSel:AddItem( "Green Team" )
		TeamSel:AddItem( "Blue Team" )
		TeamSel:AddItem( "Yellow Team" )
		TeamSel:AddItem( "Cyan Team" )
		TeamSel:AddItem( "Orange Team" )
		TeamSel:AddItem( "White Team" )
		TeamSel:AddItem( "Black Team" )
		
		local JoinButton = vgui.Create( "DButton" )
		JoinButton:SetParent( self.TeamBackground )
		JoinButton:SetText( "Join Team" )
		JoinButton:SetPos(((self.TeamBackground:GetWide()*.6)), 65 )
		JoinButton:SetSize( 150, 50 )

		
		local LeaveButton = vgui.Create( "DButton" )
		LeaveButton:SetParent( self.TeamBackground )
		LeaveButton:SetText( "Leave Team" )
		LeaveButton:SetPos(((self.TeamBackground:GetWide()*.6)), 155 )
		LeaveButton:SetSize( 150, 50 )
		LeaveButton.DoClick = function()
			LocalPlayer():ChatPrint("You left your team. You are not on anyones prop protection right now")
		end

	
		local TeamMem = vgui.Create("DListView")
		TeamMem:SetParent(self.TeamBackground)
		TeamMem:SetPos(((self.TeamBackground:GetWide()*.125 )), 300)	
		TeamMem:SetSize( 200, 175 )
		TeamMem:SetMultiSelect(false)
		TeamMem:AddColumn("Your Team")
		
		local Unassigned = vgui.Create("DListView")
		Unassigned:SetParent(self.TeamBackground)
		Unassigned:SetPos(((self.TeamBackground:GetWide()*.55 )), 300)	
		Unassigned:SetSize( 200, 175 )
		Unassigned:SetMultiSelect(false)
		Unassigned:AddColumn("Other Players")
		for k,v in pairs(player.GetAll()) do
			Unassigned:AddLine(v:Nick())
		end

		
		local Kick = vgui.Create( "DButton" )
		Kick:SetParent( self.TeamBackground )
		Kick:SetText( "Kick Player" )
		Kick:SetPos(((self.TeamBackground:GetWide()*.125)), 500 )
		Kick:SetSize( 200, 25 )
		Kick.DoClick = function()
			LocalPlayer():ChatPrint("You have kicked a player")
		end
		
				local Invite = vgui.Create( "DButton" )
		Invite:SetParent( self.TeamBackground )
		Invite:SetText( "Invite Player" )
		Invite:SetPos(((self.TeamBackground:GetWide()*.55)), 500 )
		Invite:SetSize( 200, 25 )
		Invite.DoClick = function()
			LocalPlayer():ChatPrint("You have invited a player")
		end


Factor everything with ScrW() and ScrH()

Lesson one of derma: never use absolutes. Disseminate is right on the money there.

Make a function which returns the scale you want - then make every derma object in accordance with that scale (By calling it obviously)

[lua]function surface.ScreenScale( size )
return size * ( ScrH() / 480.0 )
end

surface.SScale = surface.ScreenScale
[/lua]

What’s with the pointless last line of code there?

So you can just type surface.SScale( ) rather than surface.ScreenScale( ).

That’s like asking why ScrW( ) and ScrH( ) exist when you can surface.ScreenWidth( ) or surface.ScreenHeight( ).

Maybe we should have a W() and a H() function while we’re at it.

Well, I think the point is to get it as short as possible but still be able to identify the function.

-snip-