Results 1 to 2 of 2

Thread: Get line height of RichTextBox line - api?

  1. #1

    Thread Starter
    Hyperactive Member Trojan's Avatar
    Join Date
    Dec 2003
    Location
    Area 51
    Posts
    280

    Get line height of RichTextBox line - api?

    I need to get the line height from rich text box...

    I know for a fact that the fon't size is the same in all the line...

    need API for it?

    If so.. how?

    thanks in advanced
    MD5How To Detect Disk In Drive X?Time Tickerchanging the owner of a controlSystray HardCore

    • "Programming is like sex: one mistake and you have to support it for the rest of your life."
    • "A program is a spell cast over a computer, turning input into error messages."
    • "WARNING: Keyboard Not Attached. Press F10 to Continue."
    • "Why doesn't DOS ever say 'EXCELLENT command or filename!'"

  2. #2
    Addicted Member
    Join Date
    Apr 2006
    Location
    USA
    Posts
    207

    Re: Get line height of RichTextBox line - api?

    Hi Trojan,

    There's probably an API, but the following works.

    Add a pictureBox, set it to Visible=False and use the following code:
    VB Code:
    1. Picture1.ScaleMode = vbPixels
    2.     Picture1.Font.Size = RichTextBox1.SelFontSize
    3.     Picture1.Font.Name = RichTextBox1.SelFontName
    4.    
    5.     MsgBox Picture1.TextHeight(RichTextBox1.SelText)

    Added bonus, if needed, Picture1.TextWidth(RichTextBox1.SelText) gets the width.
    Keith_VB6

    If you have any further questions, just ask.
    If this solves things, then please mark the thread resolved.
    [Thread Tools] --> [Mark Thread Resolved]

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