How to write text angle on printer canvas

How to write text angle on printer canvas

Post by Aviran Mord » Thu, 15 Jan 1998 04:00:00

I need to write text with angles on printer.
I use SetTextAngle to do in on a screen canvas but it does'nt work on a
printer canvas.
Does anyone know how to write text with angles on a printer.



1. Draw text on printer canvas vs screen canvas


I try to draw text to print. It work pretty good on a screen device context. But it doesn't work on a printer device context. My text is misaligned an truncated. Somebody can help me to correct it?

I use the code :

procedure MyForm.PrintContentNextPage(var aRectangle: TRect);
  sText         : string;
  aRect         : TRect;
  nHeightNeeded : integer;
    sText := 'I want to print this text with wordwrap and center alignment;';

    f_Canvas.Font.Size   := 18;
    f_Canvas.Font.Style  := [fsBold];
    f_Canvas.Font.Color  := clRed;

    aRect.Top     := 0;
    aRect.Left    := 0;
    aRect.Bottom  := aRectangle.Bottom - aRectangle.Top - 8;
    aRect.Right   := aRectangle.Right  - aRectangle.Left - 8;

    nHeightNeeded := Windows.DrawText(  f_Canvas.Handle,
                                PChar( sText), -1,
                                DT_CALCRECT or DT_WORDBREAK);

    nWidthNeeded := aRect.Right - aRect.Left;
    aRect.Left := aRectangle.Left
                + ( (aRectangle.Right - aRectangle.Left - nWidthNeeded) DIV 2);
    aRect.Right := aRect.Left + nWidthNeeded;
    aRect.Top   := aRectangle.Top;
    aRect.Bottom:= aRect.Top + nHeightNeeded;

    Windows.DrawText( f_Canvas.Handle,
              PChar( sText), -1,

2. ? Pressure sensitive tablet advice

3. Unable to Write to Canvas losing GDI resources, and unable to write to canvas

4. Picture doesn't stay drawn

5. writing on a printer.canvas in a .dll

6. bg delete and fg shadow

7. writing text at an angle

8. How to write text with transparent background on a canvas with TextOut()

9. Write Text onto Canvas

10. Write text in different directions in Canvas

11. Writing Vertical Text with TImage.Canvas

12. picture->canvas to printer->canvas