如何使用书签并浏览它们而不会迷失在索引中?!
这是书签代码段:
private void btnBM(object sender, EventArgs e)
{
Line currentLine = scintilla1.Lines.Current;
if (scintilla1.Markers.GetMarkerMask(currentLine) == 0)
{
currentLine.AddMarker(0);
}
else
{
currentLine.DeleteMarker(0);
}
}
我想清除上一个指示符,并在下一个书签上添加一个指示符 向下滚动以关注下一个 我试过了:
scintilla1.Indicators[2].Search(scintilla1.GetRange(),scintilla1.GetRange(scintilla1.CurrentPos)).ClearIndicator(2);
Range R;
R = scintilla1.Markers.FindPreviousMarker().Range; <-- Causes crashes bcoz of index
scintilla1.Indicators[2].Style = IndicatorStyle.Box;
scintilla1.Indicators[2].Color = Color.DarkGoldenrod;
R.SetIndicator(2);
答案 0 :(得分:0)
我是这样做的,这是代码:
private void button20_Click_1(object sender, EventArgs e)
{
scintilla1.GetRange().ClearIndicator(2);
scintilla1.Indicators[2].Style = IndicatorStyle.Box;
scintilla1.Indicators[2].Color = Color.Cyan;
try
{
Line next = scintilla1.Markers.FindNextMarker(); //replace with previous to get the previous on the control bookmark
scintilla1.Caret.Position = next.EndPosition;
next.Range.SetIndicator(2);
scintilla1.Caret.Goto(next.EndPosition);
scintilla1.Focus();
}
catch (Exception ex)
{
MessageBox.Show("No more marks.. " + ex.Message);
}
}