trichview.com

trichview.support




"Invalid Bitmap"


Return to index


Author

Message

Rob Aley

Posted: 04/16/2002 0:21:02


Hi,


I am having trouble when printing Panels inserted into tables in RichView.

There are many panels inserted thus :


panel1 := Tpanel.create(nil);

panel1.width :=  35;

panel1.height := 15;

panel1.Color := clRed;

panel1.bevelouter := bvNone;

cl1.cells[2,1].addcontrolex('', panel1, 0, rvvaMiddle);


When trying to print, the following exception is thrown :


Project QM.exe raised exception class EInvalidGraphic with message 'Bitmap

image is not valid'.


The relevant procedures I am using for printing are :


procedure TForm5.Button1Click(Sender: TObject);

begin

  PrintDialog1.MinPage := 1;

  PrintDialog1.MaxPage := RVPrint1.PagesCount;

  PrintDialog1.FromPage := 1;

  PrintDialog1.ToPage := RVPrint1.PagesCount;

  if PrintDialog1.Execute then begin

  prepprintprev;

    case PrintDialog1.PrintRange of

      prAllPages:

        RVPrint1.Print( 'Test', PrintDialog1.Copies, PrintDialog1.Collate);

      prPageNums:

        RVPrint1.PrintPages(PrintDialog1.FromPage, PrintDialog1.ToPage, 'Test',

PrintDialog1.Copies, PrintDialog1.Collate);

    end;

  end;

end;


procedure TForm5.RVPrint1PrintComponent(Sender: TRVPrint;

  PrintMe: TControl; var ComponentImage: TBitmap);

begin

ComponentImage := Drawpanel(Tpanel(PrintMe));

end;


procedure Tform5.prepprintprev();

begin

  Screen.Cursor := crHourglass;

  RVPrint1.AssignSource(RichView1);

  RVPrint1.FormatPages(rvdoAll);

  RVPrintPreview1.ZoomMode := rvzmFullPage;

  RVPrintPreview1.First;

  Screen.Cursor := crDefault;

  RVPrint1.LeftMarginMM   := 15;

  RVPrint1.RightMarginMM  := 15;

  RVPrint1.BottomMarginMM := 15;

  RVPrint1.TopMarginMM    := 15;

  RVPrintPreview1.MarginsPen.Style := psDot;

end;


I have had it working on various other projects, but I can't see what I am

doing wrong this time. The OnPrintComponent event is set to RVPrint1PrintComponent

procedure above. I am using Delphi5.


Any ideas gratefully received!


Regards


Rob





Powered by ABC Amber Outlook Express Converter