[comp.windows.ms.programmer] Aligning Proportionally Spaced Text in a Dialog Box

burgoyne@eng.umd.edu (John R. Burgoyne) (03/20/91)

Two Questions:

1)     Is there a simple, reliable technique to have multiple lines
       of text in a dialog box which uses a proportionally spaced
       font align on a character which appears in every line?
       Consider the following example where the text is aligned on
       the colon.

             blah blah : more blah
                foobar : 87.4

       We've only been able to use trial and error with sprintf and
       TextOut to align the text with mixed success. Usually the text
       comes out slightly skewed and the colons never seem to quite
       line up.


2)     Is there a simple, reliable technique to make multiple lines
       of text align right in a dialog box which uses a
       proportionally spaced font? Again we've only done trial and
       error with sprintf and TextOut and things don't quite line up.


Thanks for any assistance.

Robert

thorp@spudge.UUCP (Don Thorp) (03/21/91)

I haven't tried this technique, but I am fairly certain that it would work.
Using centered text, writeout the alignment character.  Then draw everything
to the left of the character using right alignment and everything to the 
right of the character using left alignment.

           80 100 120
	    |  |   |
        Field  :   Information