Printing.rb run time error

I have attached a copy of printing.rb for reference.

When running this program which I got from the samples is that it gets
error under the following scenario.

1.0 Run the program.
2.0 Select the File/PageSet up menu
3.0 Hit ok on the page set up dialog.
4.0 Run your mouse over the window that exists after the dialog closes
5.0 The program dies.

a. My best guess is that the dc shown in MyCanvas class (line 196 in
attachment) has been somehow lost during the page set up dialog
I am such a Ruby newbie that I don’t know if this could be correct.

b. It appears that the on_draw(dc) at line 196 is called from Windows.
my hypothesis about the dc being lost is correct, how could I capture,
and restore it. All my attempts have failed.

c. I am digging through the printing.rb sample and putting in comments
as I
understand it better. My plan is to send the commented version
when I finish it so that it will be easier for other Ruby newbies to

  • Where would I send it when I finish adding comments?*