Garry's Mod Wiki

Panel:SetCursor

Panel:SetCursor( string cursor )

Description

Sets the appearance of the cursor.

Arguments

1 string cursor
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.

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") -- 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
cursor.png

Page Links


Special Pages


Wikis

?

Render Time: 29ms

DB GetPage 3
Generate Html 2
SaveChanges (1) 10
Render Body 0
Render Sidebar 11