Scintilla中的备用行着色 [英] Alternate row coloring in Scintilla

查看:105
本文介绍了Scintilla中的备用行着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用wxPython中的 wxStyledTextCtrl ,它是

I'm using wxStyledTextCtrl from wxPython, a wrapper around the Scintilla component.

是否有任何方法可以在其上获得交替的行颜色(一种背景颜色的奇数行,另一种颜色的偶数行)? 我正在使用内置的python样式器突出显示关键字.

Is there any way to get alternate row coloring on it (odd rows in one background color and even rows in another color)? I'm using the builtin python styler to highlight keywords.

推荐答案

行的背景可以更改,例如通过标记(用于书签或断点,IDE中的当前执行点等),但是没有内置模式可以更改其他每行的背景颜色.

The background of lines can be changed, for example by markers (which is used for stuff like bookmarks or breakpoints, current execution point and the like in IDEs), but there is no built-in mode for changing the background colour of every other line.

您可以通过为所有奇数或偶数行号设置背景颜色的特殊标记( MarkerAdd() ).这可能会耗费很多周期,并且每次拆分或合并,插入或删除行的编辑操作都需要重置标记.不过,鉴于似乎没有其他方法,可能值得研究.

You could simulate this by setting a special marker with a background colour for all odd or even line numbers (MarkerSetBackground() and MarkerAdd()). This would probably consume a lot of cycles, and each editing operation that splits or joins, inserts or deletes lines would need the markers to be reset. Still, it may be worth looking into, given that there seems to be no other way.

这篇关于Scintilla中的备用行着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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