Advertisement
Guest User

Change the colour of a GUI Edit box via 3 separate RGB slide

a guest
Feb 3rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance force
  2. SetFormat, integer, hex
  3. Gui, Add, Slider , x12 y19 w90 h20 vPipboyRed gSetColour Range0-255, 128
  4. Gui, Add, Slider, x12 y59 w90 h20 vPipboyGreen gSetColour Range0-255, 128
  5. Gui, Add, Slider, x12 y99 w90 h20 vPipboyBlue gSetColour Range0-255, 128
  6. gosub,SetColour ;Set the default colour to what's defined above.
  7. Gui, Add, Edit, x112 y19 w120 h100
  8. Gui, Show, h147 w247
  9. SetFormat, integer, d
  10. Return
  11.  
  12. SetColour:
  13.     SetFormat, integer, hex
  14.     gui,submit,nohide
  15.     PipboyRed := GetHexGUIColour(PipboyRed)
  16.     PipboyGreen := GetHexGUIColour(PipboyGreen)
  17.     PipboyBlue := GetHexGUIColour(PipboyBlue)
  18.     Gui, Color,, %PipboyRed%%PipboyGreen%%PipboyBlue%
  19.     tooltip Red:%PipboyRed%`nGreen:%PipboyGreen%`nBlue:%PipboyBlue%
  20.     return
  21.    
  22. GuiClose:
  23. ExitApp
  24.  
  25. GetHexGUIColour(InputNumber) ;Converts "0x0F" to "0F" and "1" to "01"
  26. {
  27.     InputNumber := strreplace(InputNumber,"0x")
  28.     if StrLen(InputNumber) = 1
  29.         return "0" . InputNumber
  30.     else
  31.         return InputNumber
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement