CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Posts
    47

    Centering Multiple Line Text

    I have this current chunk of code:


    xProper = (Preview.ScaleWidth - TextWidth(Subtitle.Text)) / 2
    yProper = (Preview.ScaleHeight - TextHeight(Subtitle.Text)) / 2

    Preview.CurrentX = xProper
    Preview.CurrentY = yProper
    Preview.print Subtitle.Text




    ... where 'Subtitle' is a multiline text box.

    If I put a single line in, it works great! But as soon as I put in a second line the alignment starts to fail. The first line will appear center, but subsequent lines appear on the right border.

    I figure I could parse the text based on a newline, but it seems like there should be an easier way.

    Many thanks for any help!

    Hoag


  2. #2
    Join Date
    Feb 2001
    Posts
    54

    Re: Centering Multiple Line Text

    Hello:
    Before you run the program, I must set MultiLine to true and Alignment to 2 in Properties

    Good Luck



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

Featured