Zedna Posted May 13, 2006 Share Posted May 13, 2006 (edited) EDIT3: Now I noticed somebody changed my original title from GuiCtrlCreateGraphic to _GUICtrlCreateGradient !!But problem is really in AutoIt function GuiCtrlCreateGraphic and not in this user function _GUICtrlCreateGradient. See that parameters $nWidth, $nHeight passed to _GUICtrlCreateGradient function are directly without change passed to GuiCtrlCreateGraphic...EDIT2: please can somebody correct wrong title of this topic:there should be GuiCtrlCreateGraphic instead of _GUICtrlCreateGradientGuiCtrlCreateGraphic:parameter width acts as right (position of corner of rectangle) and NOT as widthparameter height acts as bottom (position of corner of rectangle) and NOT as heightHere is my example for color rainbow:expandcollapse popup#include <Color.au3> Global $GUI_GR_LINE = 2 Global $GUI_GR_MOVE = 6 Global $GUI_GR_COLOR = 8 $gui = GUICreate("Rainbow",@DesktopWidth -5, @DesktopHeight - 25, 0, 0) $size = WinGetClientSize($gui) $step = $size[0] / 6 _GUICtrlCreateGradient(0xFF0000, 0xFFFF00, 0*$step, 0, 1*$step, $size[1]) _GUICtrlCreateGradient(0xFFFF00, 0x00FF00, 1*$step, 0, 2*$step, $size[1]) _GUICtrlCreateGradient(0x00FF00, 0x00FFFF, 2*$step, 0, 3*$step, $size[1]) _GUICtrlCreateGradient(0x00FFFF, 0x0000FF, 3*$step, 0, 4*$step, $size[1]) _GUICtrlCreateGradient(0x0000FF, 0xFF00FF, 4*$step, 0, 5*$step, $size[1]) _GUICtrlCreateGradient(0xFF00FF, 0xFF0000, 5*$step, 0, 6*$step, $size[1]) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit Wend Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight) Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $step Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $step Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $step GuiCtrlCreateGraphic($nX, $nY, $nWidth, $nHeight) For $i = 0 To $nWidth - $nX $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $sColor, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $nHeight) Next EndFuncEDIT:I must use workaround:_GUICtrlCreateGradient(0xFF0000, 0xFFFF00, (n-1)*$step, 0, n*$step, $size[1])if width would be really width in GuiCtrlCreateGraphic it should be called like this:_GUICtrlCreateGradient(0xFF0000, 0xFFFF00, (n-1)*$step, 0, $step, $size[1])EDIT2: please can somebody correct wrong title of this topic:there should be GuiCtrlCreateGraphic instead of _GUICtrlCreateGradient Edited May 13, 2006 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Valuater Posted May 13, 2006 Share Posted May 13, 2006 wow... try this run it minimize the window then maximize the window really strang effect 8) Link to comment Share on other sites More sharing options...
Zedna Posted May 13, 2006 Author Share Posted May 13, 2006 wow... try thisrun itminimize the windowthenmaximize the windowreally strang effect8)I have no problem when used your procedure (min/max).What problem it is? and what OS do you have? Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Valuater Posted May 13, 2006 Share Posted May 13, 2006 I have no problem when used your procedure (min/max).What problem it is? and what OS do you have?Win Xp Home SP2, pent 4 3.0, 19" monitor Link to comment Share on other sites More sharing options...
Zedna Posted May 13, 2006 Author Share Posted May 13, 2006 Win Xp Home SP2, pent 4 3.0, 19" monitorI tested it on WIN98SE and WINXP Pro SP2 with classic style (not XP style) and no such behaviour.I think there is maybe some collision with OnTop status of your taskar/Start button. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted May 13, 2006 Author Share Posted May 13, 2006 (edited) I just tried this corrected code and it works, so problem was in script and not in AutoIt! For $i = 0 To $nWidth - $nX For $i = 0 To $nWidth Please delete this post or move it to NO BUG subforum. And sorry for confusion expandcollapse popup#include <Color.au3> Global $GUI_GR_LINE = 2 Global $GUI_GR_MOVE = 6 Global $GUI_GR_COLOR = 8 $gui = GUICreate("Rainbow",@DesktopWidth -5, @DesktopHeight - 25, 0, 0) $size = WinGetClientSize($gui) $step = $size[0] / 6 _GUICtrlCreateGradient(0xFF0000, 0xFFFF00, 0*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0xFFFF00, 0x00FF00, 1*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0x00FF00, 0x00FFFF, 2*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0x00FFFF, 0x0000FF, 3*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0x0000FF, 0xFF00FF, 4*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0xFF00FF, 0xFF0000, 5*$step, 0, $step, $size[1]) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit Wend Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight) Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $step Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $step Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $step GuiCtrlCreateGraphic($nX, $nY, $nWidth, $nHeight) For $i = 0 To $nWidth $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $sColor, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $nHeight) Next EndFunc If you like it fullscreen use: $gui = GUICreate("Rainbow",@DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) Edited May 13, 2006 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now