Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TRichEdit: How To Check and Set Subscripts and Superscripts?

232 views
Skip to first unread message

Wanli Ma

unread,
Sep 21, 1998, 3:00:00 AM9/21/98
to
Any idea, it is not included in standard style list, thanks!

Wanli Ma
Legend Microsystems, Inc.
http://www.LegendNet.com
mailto:in...@LegendNet.com


Peter Below

unread,
Sep 22, 1998, 3:00:00 AM9/22/98
to
> Subject: TRichEdit: How To Check and Set Subscripts and Superscripts?

> Any idea, it is not included in standard style list, thanks!
>
you should be able to set sub/superscripts by sending an EM_SETCHARFORMAT
message to a TRichedit. Something like this:

Var
format: TCharFormat; { defined in Unit RichEdit }

FillChar( format, sizeof(format), 0);
With format Do Begin
cbSize:= Sizeof(format);
dwMask:= CFM_OFFSET;
yOffset:= 60;
{ superscript by 60 twips, negative values give subscripts}
End;
richedit1.Perform( EM_SETCHARFORMAT, SCF_SELECTION,
LongInt(@format));

The message affects the current selection. EM_GETCHARFORMAT can be used to
get the style set of the current selection into a TCharformat variable. You
check for sub/superscript by first testing

If (format.dwMask and CFM_OFFSET) <> 0 Then
...check format.yoffset for sign of offset

Note that richedit mark 1 (the version wrapped by Delphi's TRichedit) does
not automatically adjust the line spacing if you offset characters from the
baseline, and there is no way to change the line spacing from code. I don't
know if the newer richedit version 2.0 (there are wrappers on the Delphi
Super page, i think) handles this any better.

Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitely requested!


Wanli Ma

unread,
Sep 22, 1998, 3:00:00 AM9/22/98
to 10011...@compuserve.com
Thanks a lot, Peter. We have been searching all bookshelves for this
information. Thanks again.

Wanli Ma
Legend Microsystems, Inc.
http://www.LegendNet.com
mailto:in...@LegendNet.com

Long Truong

unread,
Sep 23, 1998, 3:00:00 AM9/23/98
to
Hi there.
Check the component TRichEdit98 with source code at Delphi Super Page or
Torry Delphi Pages. This component uses RichEd20.dll (Rich Edit 2.0) allows
OLE object and supports a dozen of new text-formatting properties. But only
few properties are working including superscript and subscipt.
Hope this help.

Wanli Ma wrote in message <36070588...@LegendNet.com>...


>Any idea, it is not included in standard style list, thanks!
>

0 new messages