[Gambas-user] Gambas-user Digest, Vol 36, Issue 53
Andreas Müller
andreas at ...2139...
Sun May 24 23:32:00 CEST 2009
Hello Werner,
thanks for answer. I have found a solution by appending the printer
coordinates to a binary file during calculation of the drawing area plot
points. As I said, it is not clear when the plotting is finished,
because it can be interactive, so I have some problems to calculate the
complete plot before doing the print out. At some point the user may
have the possibility to plot everything which is on screen by pressing a
button. This is the reason for the need to 'record' the plot in some
way.
binFile = OPEN User.Home & "/.hp9125A_image" FOR CREATE
CLOSE #binFile
(..)
Loop...
IF bPenDown THEN
(.. do some calculation & do draw into the drawing area 'DA')
(.. calculate the higher res printer coordinates)
binFile = OPEN User.Home & "/.hp9125A_image" FOR APPEND
WRITE #binFile, Xold
WRITE #binFile, Yold
WRITE #binFile, X
WRITE #binFile, Y
CLOSE #binFile
ENDIF
...End loop
After the drawing area is finished and some "print" button is pressed,
the printer values a read back from the file and the whole plotting
sequence is repeated to the printer device. That works very well.
PUBLIC SUB PrintPlot_Click()
Draw.End ' this finishes the drawing area draw method
IF Printer.Setup() THEN RETURN
Printer.Orientation = Printer.Landscape
Draw.Begin(Printer)
Draw.ForeColor = Color.Black
Draw.LineStyle = Line.Solid
binFile = OPEN User.Home & "/.hp9125A_image" FOR INPUT
WHILE NOT Eof(binFile)
READ #binFile, Xold
READ #binFile, Yold
READ #binFile, X
READ #binFile, Y
Draw.Line(Xold, Yold, X, Y)
WEND
Draw.End ' this actually prints the plot
END
-andreas
Am Sonntag, den 24.05.2009, 20:42 +0000 schrieb
gambas-user-request at lists.sourceforge.net:
> AFAIK you can only have one Draw device open at a time. Also,
> Draw.Refresh doesn't do anything while the drawing port is open, in
> fact
> the refresh only happens in the event loop so once at the end of your
> routine is enough.
> How about doing the calculation before the drawing?
More information about the User
mailing list