[comp.windows.ms] "edit" - class: How to underline?

tremmel@ira.uka.de (Wolfgang Tremmel) (10/11/90)

Hi!
I am trying to program a simple Text - Editor in MS - Windows.
Now the Question: How can I tell a window with class "edit" to
allow underlining, bold, italics etc.?
Has anybody allready done it and how?

Wolfgang Tremmel

patrickd@chinet.chi.il.us (Patrick Deupree) (10/12/90)

In article <90.283.17:04:51@ira.uka.de> tremmel@ira.uka.de (Wolfgang Tremmel) writes:
>I am trying to program a simple Text - Editor in MS - Windows.
>Now the Question: How can I tell a window with class "edit" to
>allow underlining, bold, italics etc.?
>Has anybody allready done it and how?

Well, this is an interesting one.  Since underlining is done by changing
a font to a different style (so to speak), you can't really say "underline
this text".  What you'd have to do, probably, is sub-class the edit control
and set up one that will monitor the text in the Window.  It would have to
intercept all characters coming into the edit control and output them in their
proper style.  You'd probably have to keep a buffer of text as well so that
you know what's underlined and whats not.  Then, when the screen redraws
you'd have to tell it what text to redraw in underlined form, what to draw
as italics, etc.

Not a straight forward thing to do.  It'd be easy enough to underline all
text, though.
-- 
"What's in a name?  That which we call a rose by any other name would smell
 as sweet."             William Shakespeare
Patrick Deupree ->	patrickd@chinet.chi.il.us   (708) 328-3800
(Please note there are both a patrick and a patrickd at this site)

kensy@microsoft.UUCP (Ken SYKES) (10/15/90)

In article <90.283.17:04:51@ira.uka.de> tremmel@ira.uka.de (Wolfgang Tremmel) writes:
>
>Hi!
>I am trying to program a simple Text - Editor in MS - Windows.
>Now the Question: How can I tell a window with class "edit" to
>allow underlining, bold, italics etc.?
>Has anybody allready done it and how?
>
>Wolfgang Tremmel


Alot of people wish this could be done easily.  Unfortunately the EDIT class
can only accept one font.  Now, that font can have any style you like, but
it still has to be the same font throughout the control.  For multiple font 
capability, look in Petzold on text justification, etc.  Look at WM_SETFONT to
find out how to set the font.

Ken Sykes
Disclaimer: The above opinions are solely my own.