Results 1 to 4 of 4

Thread: Formatting output in textbox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2002
    Location
    netherlands
    Posts
    18

    Formatting output in textbox

    I'm having problems formatting my programs output in a textbox,( and a .txt file).

    My output has to look like this :

    number x-coord y-coord z-coord
    ------------------------------------------------------------
    8 5145.658 8521.264 11.154
    9 5245.658 8521.264 9.154
    10 5345.658 8531.264 10.251

    I want this text to be nicely in a column, and 'right-justified'.


    Can anyone help me with this

    Thanx,

    John

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jan 2002
    Location
    netherlands
    Posts
    18
    This textbox seems not to support spaces properly so I will try with "_" in stead of " ".

    My output has to look like this:


    number____x-coord_____y-coord______z-coord
    ------------------------------------------------------------
    __8______5145.658____8521.264_____11.154
    __9______5245.658____8521.264______9.154
    _10______5345.658____8531.264_____10.251

    (the _ are spaces)

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    What not a ListView, and let it do all the work for you?

  4. #4
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    If you use a windows program and you want to justify text, you have three ways to go.

    1) You can measure the actual physical length of the text and "draw" it based on the measurements.

    2) You can use API.

    3) The easiest, but least elegent is to use a monospaced font.

    The problem you're running into is that fonts are not evenly spaced, so a combination of 4 spaces along with any other letter will not be the same length as 4 spaces with another letter, if that makes sense.

    The courier family is monospaced, so if you set your text box font to courier, then you can justify using spaces.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width