如何使用书签并浏览它们而不迷失在索引中?!
这是书签代码片段:
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);发布于 2013-02-06 06:32:18
我是这样做的,代码如下:
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);
}
}https://stackoverflow.com/questions/14717383
复制相似问题