记事本项目,我想要包装操作的代码 [英] notepad project, i want a code for wrap operation

查看:62
本文介绍了记事本项目,我想要包装操作的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我在做项目记事本.我想在记事本中编写换行文字.

hello

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

thanks in advance.

推荐答案

您应该计算窗口的宽度,然后检查添加到句子中的每个单词占用了多少空间.当您到达下一个单词溢出窗口的位置时,您应该在上一个空格处中断,并将这个单词移到下一行的开头.
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.


这篇关于记事本项目,我想要包装操作的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆