I want to put a long string in list box, which its width is more than width of list box.This is my problem:I want to put this long string in multiple lines
instead of using horizontal scroll.I mean when the string exceeds the end of line, it should back to the first of the next line.
Thank you for your helpful answers.
There is no difference for me to use list box or something else.
Is there an easier way to approach the mentioned purpose?
(show a long string in a small box)
As I said before, there is no importance to use listbox or editbox or ...
I just need a small box to show a long string.for example this is my string :
str="Hello World! Hello World!";
my edit/list box isn't wide enough to show whole the string, so it just shows : Hello World! He
I want the result to be something like this:
Hello World!
Hello World!
Then use multiline style for the edit control (ES_MULTILINE) and if you'd like to allow user to set/change control text - additionally specify ES_WANTRETURN.
my edit/list box isn't wide enough to show whole the string, so it just shows : Hello World! He
I want the result to be something like this:
Hello World!
Hello World!
Then you could format the text using CRLF to achieve line breaks for both edit () and static controls:
Thanks for you reply.
But unfortunately I don't know what my string is."Hello World!Hello World!" was an example.
In fact I'm writing a packet sniffer and I wanna show whole the data of each packet, into a separated box(this critical box)
So i'm not able to use that
m_myControl.SetWindowText(_T("1st part of string\r\n 2nd part of string"));
for going to the next line.
Thanks for you reply.
But unfortunately I don't know what my string is."Hello World!Hello World!" was an example.
In fact I'm writing a packet sniffer and I wanna show whole the data of each packet, into a separated box(this critical box)
So i'm not able to use that
m_myControl.SetWindowText(_T("1st part of string\r\n 2nd part of string"));
for going to the next line.
As I said, an edit or static control will wrap for you.
An application can use Wordwrap functions with multiline edit controls to locate the word or word fragment that should be wrapped to the next line. Using the default Wordwrap function provided by the system, lines always end at the spaces between words. An application can specify its own Wordwrap function by supplying an EditWordBreakProc Wordwrap function and sending the edit control an EM_SETWORDBREAKPROC message. An application can retrieve the address of the current Wordwrap function by sending the control an EM_GETWORDBREAKPROC message.
How do you use the default word wrapping for an edit control?
If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the Wordwrap. If the window size changes, the Wordwrapping position changes and the text is redisplayed.
Bookmarks