Alternate row coloring in Scintilla

廉价感情. 提交于 2019-12-10 16:51:46

问题


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

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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/2302165/alternate-row-coloring-in-scintilla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!