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. Windows Forms
  4. Make child controls follow scroll.

Make child controls follow scroll.

Scheduled Pinned Locked Moved Windows Forms
tutorialquestion
8 Posts 2 Posters 4 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
    Genbox
    wrote on last edited by
    #1

    Hi. I have a TextBox control with a child ProgressBar control, when ever i enter text into the TextBox, I want the ProgressBar to follow "the flow". But I can't figure out how to do this in a simple manner. Do you guys have some ideas?

    M 1 Reply Last reply
    0
    • G Genbox

      Hi. I have a TextBox control with a child ProgressBar control, when ever i enter text into the TextBox, I want the ProgressBar to follow "the flow". But I can't figure out how to do this in a simple manner. Do you guys have some ideas?

      M Offline
      M Offline
      MatrixCoder
      wrote on last edited by
      #2

      Try this:

      private void textBox1_TextChanged(object sender, EventArgs e)
      {
      progressBar1.Maximum = textBox1.MaxLength;
      progressBar1.Value = textBox1.Text.Length;
      }

      You can also set the MaxLength of the TextBox to make the ProgressBar fill slower/faster.


      Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

      G 1 Reply Last reply
      0
      • M MatrixCoder

        Try this:

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
        progressBar1.Maximum = textBox1.MaxLength;
        progressBar1.Value = textBox1.Text.Length;
        }

        You can also set the MaxLength of the TextBox to make the ProgressBar fill slower/faster.


        Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

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

        I'm sorry, I don't think I explained my problem very well. I want the progressbar's location to go up with the rest of the text. Think of MSN messenger filetransfers in the chat window, when ever there is a transfer request, a progressbar is added to the textbox and you can continue to write messages. (and the text + progressbar, will scroll up when new text is added to the conversation). I hope this is a better explanation.

        M 1 Reply Last reply
        0
        • G Genbox

          I'm sorry, I don't think I explained my problem very well. I want the progressbar's location to go up with the rest of the text. Think of MSN messenger filetransfers in the chat window, when ever there is a transfer request, a progressbar is added to the textbox and you can continue to write messages. (and the text + progressbar, will scroll up when new text is added to the conversation). I hope this is a better explanation.

          M Offline
          M Offline
          MatrixCoder
          wrote on last edited by
          #4

          I don't use MSN Messenger, so it is kind of hard for me to understand your question. If you could post a screen shot of MSN Messenger in action, I should be able to help you.


          Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

          G 1 Reply Last reply
          0
          • M MatrixCoder

            I don't use MSN Messenger, so it is kind of hard for me to understand your question. If you could post a screen shot of MSN Messenger in action, I should be able to help you.


            Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

            G Offline
            G Offline
            Genbox
            wrote on last edited by
            #5

            I've made a screenshot since it's exactly what I want. Here is the messenger conversation window with a filetransfer request: http://ianqvist.dk/stuff/Filetransfer.png And when text is entered in the chat, the progressbar (the whole filetransfer request) goes up, because the text is appended to the chat. http://ianqvist.dk/stuff/FileTransferWithText.png I'm in the progress of making the same thing, I now have a filetransfer request usercontrol and the textbox window (chat window) but i can't make the usercontrol go up when text is appended to the chat.

            M 1 Reply Last reply
            0
            • G Genbox

              I've made a screenshot since it's exactly what I want. Here is the messenger conversation window with a filetransfer request: http://ianqvist.dk/stuff/Filetransfer.png And when text is entered in the chat, the progressbar (the whole filetransfer request) goes up, because the text is appended to the chat. http://ianqvist.dk/stuff/FileTransferWithText.png I'm in the progress of making the same thing, I now have a filetransfer request usercontrol and the textbox window (chat window) but i can't make the usercontrol go up when text is appended to the chat.

              M Offline
              M Offline
              MatrixCoder
              wrote on last edited by
              #6

              Ok, sorry I was way off. So what you want to do is have a ProgressBar (File Transfer Request Control) inside a TextBox. Am I right? So what are you using for your File Transfer Control? Just a modified ProgressBar? If so, what changes have you made to it?


              Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

              G 1 Reply Last reply
              0
              • M MatrixCoder

                Ok, sorry I was way off. So what you want to do is have a ProgressBar (File Transfer Request Control) inside a TextBox. Am I right? So what are you using for your File Transfer Control? Just a modified ProgressBar? If so, what changes have you made to it?


                Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

                G Offline
                G Offline
                Genbox
                wrote on last edited by
                #7

                I really appreciate your help :) I've made a usercontrol that contains a picturebox (for preview of file), progressbar (for transfer progress) and some labellinks (accept file, cancel file and so on). I've experimented a little by using a FlowLayoutPanel. Every time i write a message, it will create a textbox and append it to the FlowLayoutPanel. This works well in the terms of positioning the filetransfer usercontrol and text, but then other problems start to arise, such as word wrapping problems, mouse selecting (i cant select text from 2 textboxes at the same time), so I don't think this is the right way to do it. So I need a way of positioning the filetransfer usercontrol in a textbox and make it part of the textflow. (like the messenger screenshots I posted)

                M 1 Reply Last reply
                0
                • G Genbox

                  I really appreciate your help :) I've made a usercontrol that contains a picturebox (for preview of file), progressbar (for transfer progress) and some labellinks (accept file, cancel file and so on). I've experimented a little by using a FlowLayoutPanel. Every time i write a message, it will create a textbox and append it to the FlowLayoutPanel. This works well in the terms of positioning the filetransfer usercontrol and text, but then other problems start to arise, such as word wrapping problems, mouse selecting (i cant select text from 2 textboxes at the same time), so I don't think this is the right way to do it. So I need a way of positioning the filetransfer usercontrol in a textbox and make it part of the textflow. (like the messenger screenshots I posted)

                  M Offline
                  M Offline
                  MatrixCoder
                  wrote on last edited by
                  #8

                  Well I've done some searching and I can't find an alternative way of positioning the File Transfer control over the TextBox. I think a FlowLayoutPanel would be your best/only shot. If you want, you could send me a copy of your control and I could see if I could tweak it a bit, but that's up to you. Sorry I couldn't help more. Let me know if you need anymore help.


                  Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

                  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