#! ruby require 'phi' include Phi require 'prev' form = Form.new sbox = ScrollBox.new form sbox.align = Phi::AL_CLIENT prev = PrevX.new sbox prev.set_bounds 0,0,1,1 btn = Button.new form, :btn, 'draw' btn.set_bounds 200,10,100,25 prev.zoom_scale = 50 btn.on_click = proc do prev.title = 'テスト' prev.doc do font = prev.canvas.font # フォントの設定 font.name = 'MS 明朝' font.size = 16 font.style = [] # テキストの出力 prev.text_out 100, 100, 'プレビュー' # 次のページへ prev.new_page # ペンの設定 pen = prev.canvas.pen p pen p pen.width pen.width = prev.pen_width 10 pen.style = Phi::PS_SOLID brush = prev.canvas.brush brush.style = Phi::BS_CLEAR # 長方形を描く prev.rectangle 300, 300, 1000, 1000 # 斜め線を描く prev.move_to 300, 300 prev.line_to 1000, 1000 end # 印刷 prev.range = 1..2 prev.print end form.show Phi.mainloop