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. .NET (Core and Framework)
  4. Textbox scrolling problem

Textbox scrolling problem

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpquestionworkspace
4 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.
  • T Offline
    T Offline
    TheIdleProgrammer
    wrote on last edited by
    #1

    Hi guys, I want to setup scrolling in a textbox (or a label), which I intend to do using a combination of string methods Remove and Append, however I want to extend the concept slightly and only scroll when the text overflows the limits of the textbox. Unfortunately I can't seem to find any way of determining that the text has overflowed the boundary. Has anybody got any ideas? Cheers, Chris.

    C 1 Reply Last reply
    0
    • T TheIdleProgrammer

      Hi guys, I want to setup scrolling in a textbox (or a label), which I intend to do using a combination of string methods Remove and Append, however I want to extend the concept slightly and only scroll when the text overflows the limits of the textbox. Unfortunately I can't seem to find any way of determining that the text has overflowed the boundary. Has anybody got any ideas? Cheers, Chris.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You'd need to create a graphics object to call MeasureString and see if the current text, with the current font, is bigger than the control.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      T 2 Replies Last reply
      0
      • C Christian Graus

        You'd need to create a graphics object to call MeasureString and see if the current text, with the current font, is bigger than the control.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        T Offline
        T Offline
        TheIdleProgrammer
        wrote on last edited by
        #3

        Ok Christian, thanks for your advice. I'll give it a try and let you know how I get on. Thanks, Chris.

        1 Reply Last reply
        0
        • C Christian Graus

          You'd need to create a graphics object to call MeasureString and see if the current text, with the current font, is bigger than the control.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          T Offline
          T Offline
          TheIdleProgrammer
          wrote on last edited by
          #4

          Excellent stuff Christian, that worked a treat. Cheers!

          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