Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

draw a multiline text like a memo control

Posted on 2001-06-09
3
Medium Priority
?
807 Views
Last Modified: 2010-04-06
I need a way to draw a multiline text on a canvas - just as in a Memo control. I think the difficulty is how to deal with 'wordwrap'. I have tried the DrawText (with DT_TEXTCONTROL) but it didn't work!

Any suggestion?
0
Comment
Question by:luckybat
[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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
f15iaf earned 300 total points
ID: 6171421
This is the example of program which draws mulit line text from memo1 to the canvas of the form


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
        rec:trect;
begin
        rec:=self.canvas.cliprect;
        //self.Canvas.TextOut(0,0,'vadim');
        drawtext(self.canvas.handle,pchar(memo1.text),length(memo1.text),rec,dt_wordbreak);
end;

end.
0
 

Author Comment

by:luckybat
ID: 6171450
f15iaf,thank you!

I have tried to use DrawText with DT_WORDBREAK. But the text looked not like in the memo. There are some space in the right of each line. The charset I am using is GB_2312. Can you tell me the reason?
0
 
LVL 3

Expert Comment

by:f15iaf
ID: 6171478
I don't have a problem on my computer.
I realy don't know how to explain it
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 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