Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

print rich text or memo to canvas

Posted on 1999-07-07
4
Medium Priority
?
720 Views
Last Modified: 2010-05-18
I am begginer and i need detailed answer on this question
I need to draw a bitmap on canvas (taht part is ok)
but on that bitamp i need to print content of the rich text box (document contain text and pictures) so that i can have effect of text and pics over background image (like background in html)
Also i must be able to print only a part of rich text box content (let's say 200 pixels or (xx lines))
(i need this beacouse i wont to simulate scrolling effects (let's say i have button and per each clikc i will restore background and display other part of rich document so that i can have effects of scrolling document))
0
Comment
Question by:xtvca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:CalvinDay
ID: 1387054
Sounds like the scrolling memo problem a few weeks ago. Did anyone ever get that to work?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1387055
the only solution is to scroll to the beginning, then copy that portion that is visible, then scroll one whole page, copy that portion to the end of the previous and so on 'till you're done with the doc...

good luck

-vik-
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 80 total points
ID: 1387056
hi xtvca,

a sample from my paq
paints a specific line (can contain various fonts and colors) from a richedit to a specific position of a bitmap


 Procedure CopyLineFromRichEditToBitmap(R : TRichEdit;
                                        Line : Integer;
                                        B : TBitMap;
                                        AtPos : TPoint);
 var
   I, C, MH, H, W : Integer;  //Counter, CharPos, MaxHeight, CharHeight, CharWidth
   TB, TB2 : TBitmap;         //Temporary Bitmaps
 begin
   TB := TBitmap.Create;      //Create Temporary
   TB2 := TBitmap.Create;
   MH := 0;                   //Initialize
   H := 0;
   TB.Height := 100;
   TB.Width := 5;
   C := R.Perform(EM_LINEINDEX,Line,0);
   for I := 0 to Length(R.Lines[Line]) do  //Paint Line
   begin
     R.Selstart := C+I;
     R.SelLength := 1;
     TB.Canvas.Font.Assign(R.SelAttributes);  //Assign CharAttributes
     W := TB.Canvas.TextWidth(R.SelText);
     TB.Width := TB.Width + W;                //Expand Bitmap
     H := TB.Canvas.TextHeight(R.SelText);
     if MH < H then                           // MaxHeight
       MH := H;
     TB.Canvas.TextOut(TB.Width-W,50-h,R.SelText);  //Paint a Char
   end;
   TB2.Width := TB.Width - 5;  //adjust Painting Rect
   Tb2.Height := MH;
   TB2.Canvas.CopyRect(Rect(0,0,TB2.Width,TB2.Height),TB.Canvas,Rect(5,50-mh,tb.width,50));

   TB2.Transparent := True;   //Prepare
   TB2.TransparentMode := tmFixed;
   TB2.TransparentColor := clWhite;
   B.Canvas.Draw(AtPos.x,AtPos.Y,TB2);  //Paint to Original
   TB2.Free;  //Free Memory
   TB.Free;
 end;

meikl
0
 

Author Comment

by:xtvca
ID: 1387057
Thanks kretzschmar
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question