trichview.com

trichview.support




Re: print a marked text


Return to index


Author

Message

Sergey Tkachenko

Posted: 01/14/2005 17:21:38


You can help to TRVPrint to print inserted components in OnPrintComponent

event.

Below is the (simplified) example for TLabel:


procedure TForm3.RVPrint1PrintComponent(Sender: TCustomRVPrint;

  PrintMe: TControl; var ComponentImage: TBitmap);

var DTOption: Integer;

    r: TRect;

const HAlignments: array[TAlignment] of Integer =

(DT_LEFT,DT_RIGHT,DT_CENTER);

      VAlignments: array[TTextLayout] of Integer = (DT_TOP, DT_VCENTER,

DT_BOTTOM);

begin

  if PrintMe is TLabel then begin

    ComponentImage := TBitmap.Create;

    ComponentImage.Height := PrintMe.Height;

    ComponentImage.Width  := PrintMe.Width;

    r := Rect(0,0,PrintMe.Width,PrintMe.Height);

    if not TLabel(PrintMe).Transparent then begin

      ComponentImage.Canvas.Brush.Color := TLabel(PrintMe).Color;

      ComponentImage.Canvas.FillRect(r);

    end;

    ComponentImage.Canvas.Font := TLabel(PrintMe).Font;

    DTOption := DT_SINGLELINE or

      HAlignments[TLabel(PrintMe).Alignment] or

VAlignments[TLabel(PrintMe).Layout];

    if not TLabel(PrintMe).ShowAccelChar then

      DTOption := DTOption or DT_NOPREFIX;

    if TLabel(PrintMe).WordWrap then

      DTOption := DTOption or DT_WORDBREAK;

    DrawText(ComponentImage.Canvas.Handle,

PChar(TLabel(PrintMe).Caption), -1, r, DTOption);

  end;

end;



>

> Hello Sergey,

>

> I want to print more than only the formated content of your memo.

>

> 1.

> I have tried it with your components  (TRVPrintPreview, RVPrint, TRVStyle,

> and RRichViewEdit).

> It works fine (the content of your JUSTIFIED memo is justified printed).

> But - I ONLY can print the content of the memo and not other components as

> TLabel etc..

>

> 2.

> Then I have tried it with the quickReport.  The problem: the content of

your

> JUSTIFIED memo is not justified printed. The other attributes (bold,

underlined

> etc.) are correct.

> I hope you can show me a way to print the content of a justified memo (and

> the content of other components (TLabel.Caption etc.)).

>

> 3.

> As soon as I print a justified marked text (whole lines) with your

components

> (look at 1.), the text is not justified printed (but  PARA_ALIGNMENT =

left).

>

> 4. My memo.height = 509. I want to know how much memo.lines are shown ?

>

> Can someone help me ?

>

> J�rgen

>

>





Powered by ABC Amber Outlook Express Converter