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. C#
  4. Accessing embedded text box scroll bars

Accessing embedded text box scroll bars

Scheduled Pinned Locked Moved C#
csharphardwaretutorialquestion
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.
  • G Offline
    G Offline
    gemani
    wrote on last edited by
    #1

    Anyone know how to access the scroll bars in a .NET TextBox control? I'm trapping the VScroll event which works fine except for when the user drags the scroll thumb, which for some reason doesn't fire the event. The only way I can think of is to trap the event at the ScrollBar level, but there doesn't appear to be a way to get hold of them programmatically. TIA Ian.

    M 1 Reply Last reply
    0
    • G gemani

      Anyone know how to access the scroll bars in a .NET TextBox control? I'm trapping the VScroll event which works fine except for when the user drags the scroll thumb, which for some reason doesn't fire the event. The only way I can think of is to trap the event at the ScrollBar level, but there doesn't appear to be a way to get hold of them programmatically. TIA Ian.

      M Offline
      M Offline
      Mohamad Al Husseiny
      wrote on last edited by
      #2

      Do you mean that you want to handle event fired when the user drag the scroll thumb? MCAD

      G 1 Reply Last reply
      0
      • M Mohamad Al Husseiny

        Do you mean that you want to handle event fired when the user drag the scroll thumb? MCAD

        G Offline
        G Offline
        gemani
        wrote on last edited by
        #3

        Thanks for your reply - yes, that's what I wanted to do. I think I've found the solution (although you may know a better way), by overriding WndProc in the TextBox as demonstrated in Help: protected override void WndProc(ref Message m) { base.WndProc(ref m); // Do first to fire the event after the text has scrolled // Listen for operating system messages. switch (m.Msg) { case WM_VSCROLL: short shtNotif = (short)((int)m.WParam & 0xffff); if (shtNotif == SB_THUMBPOSITION || shtNotif == SB_THUMBTRACK) { this.OnVScroll(new System.EventArgs()); } break; } } Ian.

        M 1 Reply Last reply
        0
        • G gemani

          Thanks for your reply - yes, that's what I wanted to do. I think I've found the solution (although you may know a better way), by overriding WndProc in the TextBox as demonstrated in Help: protected override void WndProc(ref Message m) { base.WndProc(ref m); // Do first to fire the event after the text has scrolled // Listen for operating system messages. switch (m.Msg) { case WM_VSCROLL: short shtNotif = (short)((int)m.WParam & 0xffff); if (shtNotif == SB_THUMBPOSITION || shtNotif == SB_THUMBTRACK) { this.OnVScroll(new System.EventArgs()); } break; } } Ian.

          M Offline
          M Offline
          Mohamad Al Husseiny
          wrote on last edited by
          #4

          good you found the solution this was what i will suggest if you didn't found the solution to override WndProc and catch WM_VSCROLL so this only solution i know MCAD

          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