Garry's Mod Wiki

Panel:SetCursor

  Panel:SetCursor( string cursor )

Description

Sets the appearance of the cursor. You can find a list of all available cursors with image previews here.

Arguments

1 string cursor
The cursor to be set. Can be one of the following:

Set to anything else to set it to "none", the default fallback. Do note that a value of "none" does not, as one might assume, result in no cursor being drawn - hiding the cursor requires a value of "blank" instead.

Example

function draw.CustomCursor(panel, material) -- Paint the custom cursor local cursorX, cursorY = panel:LocalCursorPos() surface.SetDrawColor(255, 255, 255, 240) surface.SetMaterial(material) surface.DrawTexturedRect(cursorX, cursorY, 20, 20) end local myPanel = vgui.Create("DFrame") myPanel:SetCursor("blank") -- Make the default cursor disappear local customCursorMaterial = Material("vgui/your_cursor") myPanel.Paint = function(s, w, h) draw.CustomCursor(s, customCursorMaterial) end
cursor.png