[Gambas-user] DRAWEREA
Benoît Minisini
gambas at ...1...
Sat Apr 4 20:18:51 CEST 2009
> hello,
> I'm new and I have a question.
> I would like to draw some points in defferent colors in a drawarea.
> But my program dosn't work. (see source) There is nothing to see. (no
> points)
> Can somebody help me?
>
> Source:
> DrawingArea1.Clear
> DrawingArea1.Show
> DrawingArea1.Visible = TRUE
> DrawingArea1.Foreground = Color.Black
> DrawingArea1.Background = Color.White
> DrawingArea1.Refresh
> Draw.Begin(DrawingArea1)
> Draw.Transparent = FALSE
> Draw.ForeColor = Color.Black
> Draw.Foreground = Color.Black
> Draw.BackColor = Color.White
> Draw.Background = Color.White
> Draw.FillStyle = 1
> f = &HFF00
> FOR x = 10 TO 50 STEP 1
> Draw.ForeColor = f
> Draw Foreground = f
> FOR y = 10 TO 50 STEP 1
> Draw.Point(x, y)
> NEXT
> f = f + 4
> NEXT
> Draw.End
> DrawingArea1.Refresh
A DrawingArea has two possible behaviours:
1) When its Cached property is set to False (the default).
Then you must draw inside the DrawingArea Draw event handler. This event will
be raised each time X11 tells your application that the drawing area has to be
redrawn. You don't have to call Draw.Begin() and Draw.End() inside the event
handler, this is done automatically.
In that case, drawing outside of the Draw event handler is useless.
2) When its Cached property is set to True.
Then drawing on the DrawingArea is done inside a internal bitmap buffer. Then
you can draw when you want, and the internal bitmap buffer will be used to
refresh the DrawingArea contents as needed.
Regards,
--
Benoît
More information about the User
mailing list