示例#1
0
        private void m_rButton_Indicator_for_URL_Click(object sender, EventArgs e)
        {
            //https://github.com/jacobslusser/ScintillaNET/issues/111
            // Define an indicator for marking URLs and apply it to a range.
            // How you determine a particular range is a URL and how often
            // you want to scan the text for them is up to you.
            m_rScintilla_TextArea.Indicators[0].Style     = IndicatorStyle.Plain;
            m_rScintilla_TextArea.Indicators[0].ForeColor = Color.Blue;
            m_rScintilla_TextArea.IndicatorCurrent        = 0;
            m_rScintilla_TextArea.IndicatorFillRange(0, 21);             // Use your own logic

            // An indicator can only change the appearance of text in one way. So
            // to get underlining AND a different foreground color we have to use two indicators.
            m_rScintilla_TextArea.Indicators[1].Style     = IndicatorStyle.TextFore;
            m_rScintilla_TextArea.Indicators[1].ForeColor = Color.Blue;
            m_rScintilla_TextArea.IndicatorCurrent        = 1;
            m_rScintilla_TextArea.IndicatorFillRange(0, 21);             // Use your own logic


            // Indicator 10 - out of Lexer indicators - Filip
            m_rScintilla_TextArea.Indicators[10].Style     = IndicatorStyle.TextFore;
            m_rScintilla_TextArea.Indicators[10].ForeColor = Color.LightBlue;
            m_rScintilla_TextArea.IndicatorCurrent         = 10;
            string sDemoTextRange = m_rScintilla_TextArea.GetTextRange(25, 30);
            int    nText_Length   = m_rScintilla_TextArea.Text.Length;
            int    nTextLength    = m_rScintilla_TextArea.TextLength;       // before updating Cache - old size - https://github.com/jacobslusser/ScintillaNET/issues/223

            m_rScintilla_TextArea.IndicatorFillRange(25, 30);

            // BONUS: Configure call tips for the Dwell events
            m_rScintilla_TextArea.MouseDwellTime = 400;
            m_rScintilla_TextArea.Styles[Style.CallTip].SizeF     = 8.25F;
            m_rScintilla_TextArea.Styles[Style.CallTip].ForeColor = SystemColors.InfoText;
            m_rScintilla_TextArea.Styles[Style.CallTip].BackColor = SystemColors.Info;
        }