Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用行号构建了一个小编辑器。现在,如果删除了换行符,我想删除它们。一种方法可能是我计算每个 textchanged 事件的换行符,但我不喜欢这样。是否有可能检查换行符是否被删除?
您可以将行数存储在一个变量中,例如_linesCnt,然后TextChanged如果您将_linesCnt与您的richtextboxLines.Count属性进行比较,如果它们不同 - 重新计算您的行号。
_linesCnt
TextChanged
Lines.Count