[Gambas-user] Drawing Area Location in Screenshot Depends on Window Location on Desktop

Tobias Boege taboege at ...626...
Wed Feb 5 18:23:56 CET 2014


On Wed, 05 Feb 2014, Fabien Bodard wrote:
> And hOmage=daChart.grab ?

No, DrawingArea.Grab() is still Control.Grab() which, according to the
documentation[0] does something very different since Gambas 3.

Whenever I wanted to save something from a DrawingArea later, I wrote
something like this routine:

Public Sub PaintIt()
  Paint.Line(...)
  ' ...
End

which is agnostic about the Paint device. In the DrawingArea_Draw() event
handler, I would call this procedure and when a picture with the contents
is to be saved, I would create a Picture and start a Paint on it, then call
that routine above again.

Depending on your application (when the paint to the picture may already
produce something different from the DrawingArea contents), you may also
always paint to a Picture in the DrawingArea_Draw() event handler and then
draw the Picture onto the DrawingArea in a second step.

Taking a screenshot to get the DrawingArea contents seems to be a very ugly
method to me.

Regards,
Tobi

[0] http://gambasdoc.org/help/comp/gb.qt4/control/grab?v3

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list