我需要从行号Y
开始从textctrl中间删除X行有没有简单的方法可以做到这一点?我看不到一个:似乎我必须以某种方式搜索TextCtrl的内容,计算换行符以找到Y的位置......
答案 0 :(得分:1)
if self._log.GetNumberOfLines() > MAX_LINES:
if self._log.GetLineText(DELETION_POINT) != DELETION_LINE:
start = self._log.XYToPosition(0, DELETION_POINT)
self._log.SetInsertionPoint(start)
self._log.WriteText(DELETION_LINE)
while (self._log.GetNumberOfLines() > MAX_LINES):
start = self._log.XYToPosition(0, DELETION_POINT+1)
len = self._log.GetLineLength(DELETION_POINT+1)
self._log.Remove(start, start+len+1)