Make child controls follow scroll.
-
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?
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.
-
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.
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.
-
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.
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.
-
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.
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.
-
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.
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.
-
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.
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)
-
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)
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.