This is simplified version of my script:
The question is: Why is my $GUI_GR_REFRESH refreshing all previous drawings before refreshing the last one? And by sequence, one line at a time, shouldn't it work like refreshing all Graphic control without user noticing it?
Or is there a faster method to draw pixels? (I don't have to use Graphic control, the canvas would be awesome, but I dunno if Autoit has canvas, and GDI+ is even slower when it comes to drawing 65025 pixels)
Also, why is my button disappearing while using graphics refresh?
[ autoit ]
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 400, 400) $Button1 = GUICtrlCreateButton("0", 0, 0, 400, 50) Global $counter = 0 Local $x = 100 Local $y = 100 $MapGraphics = GUICtrlCreateGraphic($x, $y, 255, 255) GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $counter += 1 GUICtrlSetData($Button1, $counter) $text = '' For $i = 0 to 65025/255 Local $num = Random(0, 3, 1) For $j = 0 to 255 $text &= $num Next Next Local $mapDots = StringSplit($text, '') Local $x = 0 Local $y = 0 For $i = 1 to $mapDots[0] Switch Number($mapDots[$i]) Case 1 GUICtrlSetGraphic($MapGraphics, $GUI_GR_COLOR, 0x006400) GUICtrlSetGraphic($MapGraphics, $GUI_GR_PIXEL, $x, $y) Case 2 GUICtrlSetGraphic($MapGraphics, $GUI_GR_COLOR, 0xFF8000) GUICtrlSetGraphic($MapGraphics, $GUI_GR_PIXEL, $x, $y) Case Else GUICtrlSetGraphic($MapGraphics, $GUI_GR_COLOR, 0x000000) GUICtrlSetGraphic($MapGraphics, $GUI_GR_PIXEL, $x, $y) EndSwitch $x += 1 If $x = 256 Then $x = 0 $y += 1 EndIf Next GUICtrlSetGraphic($MapGraphics, $GUI_GR_REFRESH) EndSwitch WEnd
The question is: Why is my $GUI_GR_REFRESH refreshing all previous drawings before refreshing the last one? And by sequence, one line at a time, shouldn't it work like refreshing all Graphic control without user noticing it?
Or is there a faster method to draw pixels? (I don't have to use Graphic control, the canvas would be awesome, but I dunno if Autoit has canvas, and GDI+ is even slower when it comes to drawing 65025 pixels)
Also, why is my button disappearing while using graphics refresh?