Board index » delphi » Superscript/subscript

Superscript/subscript

I have problems putting some text in superscript / subscript in an edit
/ memo / label.

the purpose is putting chemical formulae in textoutput.
Like : water : H2o : The 2 should be subscript.

Is this possible ?? Are there tools/components for this??

Thanks

Rosvelds Hans
Hans.rosve...@ordab.com

 

Re:Superscript/subscript


default label (etc.) controls won't let you specify multiple font styles
for a single control. you could either use something like RichEdit, use
multiple controls, or find a 3rd party solution -- try:

        http://sunsite.icm.edu.pl/delphi/
        www.delphi32.com.

--
http://www.ChamisPlace.com/Tips/
The place to get new Internet, Delphi and Windows tips daily!

Hans Rosvelds <Hans.Rosve...@Ordab.com> wrote in article
<32D19DFC.7...@Ordab.com>...

Quote
> I have problems putting some text in superscript / subscript in an edit
> / memo / label.

> the purpose is putting chemical formulae in textoutput.
> Like : water : H2o : The 2 should be subscript.

> Is this possible ?? Are there tools/components for this??

> Thanks

> Rosvelds Hans
> Hans.rosve...@ordab.com

Re:Superscript/subscript


Quote
> Hans Rosvelds <Hans.Rosve...@Ordab.com> wrote in article
> <32D19DFC.7...@Ordab.com>...
>> I have problems putting some text in superscript / subscript in an edit
>> / memo / label.

>> the purpose is putting chemical formulae in textoutput.
>> Like : water : H2o : The 2 should be subscript.

>> Is this possible ?? Are there tools/components for this??

>> Thanks

>> Rosvelds Hans
>> Hans.rosve...@ordab.com

In article <01bbfc63$a48c98a0$984d45c6@hpxu>
"Chami" <72223...@compuserve.com> followed:

Quote
> default label (etc.) controls won't let you specify multiple font styles
> for a single control. you could either use something like RichEdit, use
> multiple controls, or find a 3rd party solution -- try:

>    http://sunsite.icm.edu.pl/delphi/
>    www.delphi32.com.

> --
> http://www.ChamisPlace.com/Tips/
> The place to get new Internet, Delphi and Windows tips daily!

Unfortunately, RichEdit can't do sub/superscript as it stands. However, the underlying
Win95 control is capable of it so it is possible to write a descendant which
does support this important formatting feature.
I have not yet had the time to sit down and write such an enhanced RichEdit component,
so if there already is someone who did this, please post it here!

Best regards,
Kim Oechsle Hansen

----------------------------------------
AKA-PRINT A/S
Sommervej 8
8210 Aarhus V
Denmark
Phone: +45  8675 0033
Fax:      +45 8675 0133
e-mail:   akapr...@inet.uni-c.dk

Re:Superscript/subscript


actually, you can get TRichEdit to display anything any other rich edit
control can using the following method:

for example, let's consider adding sub/superscripts...

- go into any editor with RTF support, for example, Microsoft word
- type and format your text
- save the file in RTF format (let's say to c:\test.rtf)
- add following code to your delphi program (of course, RichEdit1 being the
name of your rich edit control):

        RichEdit1.PlainText := False;
        RichEdit1.Lines.LoadFromFile( 'c:\test.rtf' );

you don't necessarily have to load the RTF code from a file, you could
rather set your RichEdit's lines from your code.

--
http://www.ChamisPlace.com/Tips/
The place to get new Internet, Delphi and Windows tips daily!

Kim Oechsle Hansen <akapr...@inet.uni-c.dk> wrote in article
<5b2ebs$...@news.uni-c.dk>...

Quote
> In article <01bbfc63$a48c98a0$984d45c6@hpxu>
> "Chami" <72223...@compuserve.com> followed:

> > default label (etc.) controls won't let you specify multiple font
styles
> > for a single control. you could either use something like RichEdit, use
> > multiple controls, or find a 3rd party solution -- try:

> >       http://sunsite.icm.edu.pl/delphi/
> >       www.delphi32.com.

> > --
> > http://www.ChamisPlace.com/Tips/
> > The place to get new Internet, Delphi and Windows tips daily!

> Unfortunately, RichEdit can't do sub/superscript as it stands. However,
the underlying
> Win95 control is capable of it so it is possible to write a descendant
which
> does support this important formatting feature.
> I have not yet had the time to sit down and write such an enhanced
RichEdit component,
> so if there already is someone who did this, please post it here!

> Best regards,
> Kim Oechsle Hansen

> ----------------------------------------
> AKA-PRINT A/S
> Sommervej 8
> 8210 Aarhus V
> Denmark
> Phone: +45  8675 0033
> Fax:      +45 8675 0133
> e-mail:   akapr...@inet.uni-c.dk

Other Threads