name22

Mathematically positioning a 2D Array of Elements

Aug 18th, 2013
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Global $iUnmarked = 0x5C5C5C
  2. Global $iMarked = 0x0400FF
  3.  
  4. Global $iX_Origin = 20
  5. Global $iY_Origin = 30
  6. Global $nX_Distance = 79
  7. Global $nY_Distance = 52.5
  8.  
  9. Global $iWidth = 45
  10. Global $iHeight = 45
  11.  
  12. Global $iColumns = 5
  13. Global $iRows = 8
  14.  
  15. Global $aPixel[$iColumns * $iRows]
  16.  
  17. Global $hGUI = GUICreate("Example", ($iColumns - 1) * $nX_Distance + $iX_Origin * 2 + $iWidth, ($iRows - 1) * $nY_Distance + $iY_Origin * 2 + $iHeight)
  18. For $i = 0 To 39
  19.     $aPixel[$i] = GUICtrlCreateButton("", Mod($i, $iColumns) * $nX_Distance + $iX_Origin, Floor($i / $iColumns) * $nY_Distance + $iY_Origin, $iWidth, $iHeight)
  20. Next
  21. GUISetState()
  22.  
  23. While GUIGetMsg() <> -3
  24. WEnd
RAW Paste Data