'From:  "apple20026789" Sun Sep 22, 2002  9:03 pm
' save the canvas content to bmp file

     $INCLUDE "RAPIDq.INC"

     DECLARE SUB CanvasPaint(Sender AS QBITMAP)
     DECLARE SUB paint
     DIM Destinationbmp AS QRECT
     DIM SourceCanvas AS QRECT
     DIM bmp1 AS QBITMAP
     DIM Canvas AS QCANVAS
     CREATE Form AS QFORM
      left= 300
      top=300

      Width=520
      Height=520
      Center
      AutoScroll=false
      CREATE button AS QBUTTON
       left= 420
       top=50
       onclick=CanvasPaint
      END CREATE
     END CREATE

     WITH Canvas
      .Parent=form
      .top=0
      .left=0
      .Width=300
      .Height=300
      .OnPaint = Paint
     END WITH

     form.showmodal

     SUB Paint
      Canvas.Paint(0,0,clwhite,clwhite)'&H0000FF)
      Canvas.RoundRect(0,0,Canvas.width,Canvas.height,16,16,clred)

      Canvas.Textout (35,20,"Beware the power of Rapid-Q!", _
       &H00FF00, 0)
      Canvas.Textout (30,40,"Credit Scroller written in Rapid-Q _
by William Yu", &HFFFFFF, 0)

     END SUB


     SUB CanvasPaint(Sender AS QBITMAP)'QCanvas )
      WITH bmp1

       .width = canvas.Width
       .height = canvas.Height
      END WITH
      WITH Destinationbmp
       .Top = 0
       .Left = 0
       .Right = canvas.Width
       .Bottom = canvas.Height

      END WITH
      WITH SourceCanvas
       .Top = 0
       .Left = 0
       .Right = canvas.Width
       .Bottom =canvas.Height
      END WITH


      bmp1.CopyRect(Destinationbmp, Canvas, SourceCanvas)
      bmp1.SaveToFile("bmp1.bmp")

     END SUB

