Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. resizing form with a RTB inside

resizing form with a RTB inside

Scheduled Pinned Locked Moved Visual Basic
question
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hang_em
    wrote on last edited by
    #1

    I have this RTB on my form which display/have text (some 50 words and some 400 words), when I resize the form, it cuts the RTB and some text disappear, I need a way to make my RTB resize automatically as the form resize, is there anyway i can do this ?

    D 1 Reply Last reply
    0
    • H hang_em

      I have this RTB on my form which display/have text (some 50 words and some 400 words), when I resize the form, it cuts the RTB and some text disappear, I need a way to make my RTB resize automatically as the form resize, is there anyway i can do this ?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Did you notice teh Anchor property of the RTB?? It anchors the edges of the control to the edges of the parent container it's in, probably your form.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      H 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Did you notice teh Anchor property of the RTB?? It anchors the edges of the control to the edges of the parent container it's in, probably your form.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        H Offline
        H Offline
        hang_em
        wrote on last edited by
        #3

        Well thanks, but thats not exactly my problem. I have this RTB to display text, when running the program the display is fine with the default form size and RTB size, but when I resize the form the text inside the RTB cannot change proportionally instead it cuts the RTB and the text inside. I want automatic word wrapping feature for the text in RTB as the form get resize (like maximize and minimizing the form).

        D 1 Reply Last reply
        0
        • H hang_em

          Well thanks, but thats not exactly my problem. I have this RTB to display text, when running the program the display is fine with the default form size and RTB size, but when I resize the form the text inside the RTB cannot change proportionally instead it cuts the RTB and the text inside. I want automatic word wrapping feature for the text in RTB as the form get resize (like maximize and minimizing the form).

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          You're not explaining your problem very well. Are you saying that you want the font the text in the RTB is displayed in to resize itself so that it looks the same and fills the same area of the RTB the form is resized??

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          H 1 Reply Last reply
          0
          • D Dave Kreskowiak

            You're not explaining your problem very well. Are you saying that you want the font the text in the RTB is displayed in to resize itself so that it looks the same and fills the same area of the RTB the form is resized??

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak

            H Offline
            H Offline
            hang_em
            wrote on last edited by
            #5

            Yes something like that, i want the text inside the RTB to adjust automatically as the form get resize not the font size. (this form resize means manual resizing by mouse), i.e. i want the word inside the RTB to wrap automatically (like word wraping features)

            D 1 Reply Last reply
            0
            • H hang_em

              Yes something like that, i want the text inside the RTB to adjust automatically as the form get resize not the font size. (this form resize means manual resizing by mouse), i.e. i want the word inside the RTB to wrap automatically (like word wraping features)

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              The RTB won't do that. You'd have to write your own version of the control and it won't be easy. The problem is that as your custom drawing your RTB, you have to measure a string in a font size and see how big the resulting bitmap image would be. If it's not big enough, or small enough, you have to create a new Font object to test and call MeasureString again, until you achieve the fit you want. This is complicated by the fact that you still want WordWrap to work... Oh, and the RTB doesn't consider one line of text on screen a single line. A single line of text wraps and keeps wrapping until a line break is hit. So, how many lines of text on screen are in that string?? See the problem??

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups