Sign in to follow this  
Followers 0
oMBRa

My graphic won't redrawn

5 posts in this topic

My graphic won't redraw when I click Go

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>



Global $pi = 3.14159265358979
Global $a[3]
Global $ALPHA = 30
Global $HEIGHT = 150
$Draw = GUICreate("My Draw")
$input = GUICtrlCreateInput("21", 300, 10, 50, 20)
$updown = GUICtrlCreateUpdown($input)
$Button = GUICtrlCreateButton("Go", 300, 50)
Example()

Func Example()
    Local $msg
    
    MakeDraw()

    Do
        $msg = GUIGetMsg()
        If $msg = $Button Then
            Global $ALPHA = GUICtrlRead($input)
            Draw()
        EndIf

    Until $msg = $GUI_EVENT_CLOSE
EndFunc  ;==>Example


Func MakeDraw()
    Local $x, $z
    

    $a[1] = GUICtrlCreateGraphic(10, 200, 10, 10)
    GUICtrlSetStyle(-1, $SS_NOTIFY)
    
    
    $a[2] = GUICtrlCreateGraphic(0, 0, 10, 10)
    GUICtrlSetStyle(-1, $SS_NOTIFY)
;GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0x)
    
    Draw()
    GUISetState()
EndFunc  ;==>MakeDraw



Func Draw()
    For $i = 1 To $HEIGHT
        GUICtrlSetGraphic($a[1], $GUI_GR_PIXEL, 0, -$i);altezza
    Next


    $degToRad = $pi / 180
    $z = Tan(Execute('$ALPHA * $degToRad'))
    $z = Execute('$HEIGHT / $z')
    For $i = 1 To $z

        GUICtrlSetGraphic($a[1], $GUI_GR_PIXEL, $i, 0);base
    Next
    $ipotenusa = Sqrt(Execute('$HEIGHT^2 + $z^2'))
    GUICtrlSetGraphic($a[1], $GUI_GR_MOVE, 0, -$HEIGHT)
    GUICtrlSetGraphic($a[1], $GUI_GR_LINE, $z, 0);ipotenusa
;GUICtrlSetGraphic($a[2], $GUI_GR_COLOR, 0, 0x)
    GUICtrlSetGraphic($a[2], $GUI_GR_PIE, Execute('40 + $z - 30'), 200, 20, 180, -$ALPHA)
EndFunc  ;==>Draw

Share this post


Link to post
Share on other sites



You need to tell the graphic control to refresh.

Put this at the bottom of your Draw() function.

GUICtrlSetGraphic($a[1],$GUI_GR_REFRESH)
GUICtrlSetGraphic($a[2],$GUI_GR_REFRESH)

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites

ok, but now it overlaps the previous triangle

Share this post


Link to post
Share on other sites

Two options here:

1) delete the graphic controls and re-create them each time the button is clicked

2) look here


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites

Two options here:

1) delete the graphic controls and re-create them each time the button is clicked

2) look here

I managed to do it with deleting and re-creating

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0