Skip to content

Instantly share code, notes, and snippets.

@tluyben
Created March 31, 2013 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tluyben/5280319 to your computer and use it in GitHub Desktop.
Save tluyben/5280319 to your computer and use it in GitHub Desktop.
Field parentCache:GuiVector2D
'summary: This returns the rendering position of this control. The result is presented on Device coordinates. (screen pixels)
Method CalculateRenderPosition:GuiVector2D()
If _cacheRenderPosCalcuation = Null Then _cacheRenderPosCalcuation = New GuiVector2D
_cacheRenderPosCalcuation.SetValues (Position.X, Position.Y)
If parentCache = Null
parentCache = New GuiVector2D()
parentCache.SetValues(0,0)
Local parent:ContainerControl = _parentControl
While parent<>Null
parentCache.X += parent.Position.X + parent.Padding.Left
parentCache.Y += parent.Position.Y + parent.Padding.Top
parent = parent._parentControl
Wend
End
_cacheRenderPosCalcuation.X += parentCache.X
_cacheRenderPosCalcuation.Y += parentCache.Y
Return _cacheRenderPosCalcuation
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment