Click here to Skip to main content
15,905,323 members
Please Sign up or sign in to vote.
1.57/5 (4 votes)
See more:
hello

I m doing project notepad. I want to code for wrap text in notepad.

thanks in advance.
Posted

1 solution

You should calculate the width of your window and then check how much space is taken by each word added to a sentence. When you get to a point where the next word overflows the window you should break at the previous space, and move this word to the start of the next line.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900