RichTextBox line heights

Discussion in 'Microsoft C# .NET' started by Beringer, Feb 4, 2005.

  1. Beringer

    Beringer Guest

    Does anybody know a way to get the heights of the various lines of text in a
    RichTextBox?

    I'm not sure if "height" is the proper term. But what I'm getting at is
    that if you set the
    font size of some selected text on a line the entire line "height" expands
    to the new font
    size.

    I want that!

    Thanks in advance,
    Eric
     
    Beringer, Feb 4, 2005
    #1
    1. Advertisements

  2. use GetPositionFromCharIndex method.

    you must know the index of your carrage return. for example, if your text is
    "hello\nword" :
    lineHeight=myRichText.GetPositionFromCharIndex(6).Y-myRichText.GetPositionFr
    omCharIndex(5).Y;

    Hope it helps.
    Ludovic Soeur.


    "Beringer" <> a écrit dans le message de
    news:blush:dFMd.8288$6u.5029@fed1read02...
    > Does anybody know a way to get the heights of the various lines of text in

    a
    > RichTextBox?
    >
    > I'm not sure if "height" is the proper term. But what I'm getting at is
    > that if you set the
    > font size of some selected text on a line the entire line "height" expands
    > to the new font
    > size.
    >
    > I want that!
    >
    > Thanks in advance,
    > Eric
    >
    >
    >
     
    Ludovic SOEUR, Feb 9, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peer K

    Richtextbox line-by-line

    Peer K, Sep 17, 2004, in forum: Microsoft C# .NET
    Replies:
    1
    Views:
    326
    Michael C
    Sep 18, 2004
  2. Champika Nirosh
    Replies:
    0
    Views:
    620
    Champika Nirosh
    Oct 18, 2004
  3. Liam McNamara
    Replies:
    0
    Views:
    486
    Liam McNamara
    Nov 17, 2004
  4. Alan
    Replies:
    0
    Views:
    552
  5. Ludovic SOEUR
    Replies:
    0
    Views:
    1,592
    Ludovic SOEUR
    Feb 9, 2005
Loading...

Share This Page