passing text to preview on a seperate form
How would I pass text in a richedit component to the printpreview component on a seperate form?
The place to exchange ideas and experiences on Delphi programming
http://forum.delphiarea.com/
procedure TForm1.Button1Click(Sender: TObject);
var
R: TRect;
OneInch: Integer;
begin
Form2.Show;
with Form2.PrintPreview do
begin
OneInch := ConvertUnit(10, mmLoEnglish, Units);
SetRect(R, 0, 0, PaperWidth, PaperHeight);
InflateRect(R, -OneInch, -OneInch);
PaintRichText(R, RichEdit1, 0, nil);
end;
end;procedure TForm2.PrintRichEdit(RichEdit: TCustomRichEdit);
var
R: TRect;
OneInch: Integer;
begin
with PrintPreview do
begin
OneInch := ConvertUnit(10, mmLoEnglish, Units);
SetRect(R, 0, 0, PaperWidth, PaperHeight);
InflateRect(R, -OneInch, -OneInch);
PaintRichText(R, RichEdit, 0, nil);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
Form2.PrintRichEdit(RichEdit1);
end;