Revision Difference
Panel:SetCursor#528703
<function name="SetCursor" parent="Panel" type="classfunc">
<description>Sets the appearance of the cursor.</description>⤶
<description>Sets the appearance of the cursor. You can find a list of all available cursors with image previews [here](https://wiki.facepunch.com/gmod/Cursors).⤶
</description>⤶
<realm>Client</realm>
<args>
<arg name="cursor" type="string">The cursor to be set. Can be one of the following:
* arrow
* beam
* hourglass
* waitarrow
* crosshair
* up
* sizenwse
* sizenesw
* sizewe
* sizens
* sizeall
* no
* hand
* blank
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.</arg>
</args>
</function>
<example>
<code>
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")
-- Make the default cursor disappear
myPanel:SetCursor("blank")
local customCursorMaterial = Material("vgui/your_cursor")
myPanel.Paint = function(s, w, h)
draw.CustomCursor(s, customCursorMaterial)
end
</code>
</example>
<upload src="5598e/8d7dfba5b02b2c7.png" size="5451" name="cursor.png" />