Results 1 to 6 of 6

Thread: make form height match richtextbox.height

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    157

    make form height match richtextbox.height

    I have a borderless form with a richtextbox. When the rtb is loaded how can i make the form height match the rtb height.
    This does not work:
    me.height = rtb.height the form does not expand high enough

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: make form height match richtextbox.height

    The form should not be matching to the richtextbox....the richtextbox should be matching to the form.

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: make form height match richtextbox.height

    Whar are you actually trying to accomplish? Do you want the form to be the same size as the rtb? If you just want the form's height to be the same then the rtb should be at 0.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    157

    Re: make form height match richtextbox.height

    Quote Originally Posted by MartinLiss View Post
    Whar are you actually trying to accomplish? Do you want the form to be the same size as the rtb? If you just want the form's height to be the same then the rtb should be at 0.
    yes i want the form height to be based on the height of the rtb

  5. #5

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    157

    Re: make form height match richtextbox.height

    Quote Originally Posted by MartinLiss View Post
    Does this do it for you?

    Code:
    Private Sub Form_Load()
    RichTextBox1.Top = -20
    Me.Height = RichTextBox1.Height
    End Sub
    ok here's what i got
    I am loading a rtb from another rtb on another form and i am able to match the height of the 2nd rtb to it's contents. Like in this articule:
    http://support.microsoft.com/kb/q257849/
    i then plan on saving the form image as a jpg

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