resizing form with a RTB inside
-
-
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 ?
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 -
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 KreskowiakWell 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).
-
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).
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 -
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 KreskowiakYes 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)
-
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)
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