[Gambas-user] Can not draw outside of draw event handler

Matti math.eber at ...221...
Tue Mar 29 17:21:01 CEST 2011


You don't need all those Draw.Begin and Draw.End:

"A Draw.Begin on the drawing area is automatically called before raising the
event, and the drawing is clipped to the area to be redrawn.
Draw.End will be automatically called after the event." (Wiki)

So, just do

iAct = 1
drawArea.Refresh



Am 29.03.2011 10:29, schrieb Demosthenes Koptsis:

> ----------------------
> Public Sub btnLine_Click()
> 
> iAct = 1
> Draw.Begin(drawArea)
> drawArea_Draw()
> Draw.End
> 
> End
> 
> 
> Public Sub btnPolygon_Click()
> 
> iAct = 2
> Draw.Begin(drawArea)
> drawArea_Draw()
> Draw.End
> 
> 
> End
> 
> 
> Public Sub drawArea_Draw()
> 
> Select Case iAct
>   Case 1 'draw line
> 
>     SetValues()
> 
>     Draw.Line(55, 47, 289, 367)
> 
> 
>   Case 2
> 
>    SetValues()
> 
>    Draw.Polygon(aPolygon)
> 
>  
> End Select
> 
> End
> --------------------------
> 
> 




More information about the User mailing list