首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >scintilla.NET书签接口

scintilla.NET书签接口
EN

Stack Overflow用户
提问于 2013-02-06 05:35:36
回答 1查看 977关注 0票数 2

如何使用书签并浏览它们而不迷失在索引中?!

这是书签代码片段:

代码语言:javascript
复制
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);
        }
    }

我想清除前一个指示器,并在下一个书签上放置一个指示器,同时向下滚动以专注于我尝试的下一个书签:

代码语言:javascript
复制
      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);
EN

回答 1

Stack Overflow用户

发布于 2013-02-06 06:32:18

我是这样做的,代码如下:

代码语言:javascript
复制
   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);
        }
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14717383

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档