當前位置: 首頁>>代碼示例>>C#>>正文


C# ScintillaControl.MBSafeCharPosition方法代碼示例

本文整理匯總了C#中ScintillaNet.ScintillaControl.MBSafeCharPosition方法的典型用法代碼示例。如果您正苦於以下問題:C# ScintillaControl.MBSafeCharPosition方法的具體用法?C# ScintillaControl.MBSafeCharPosition怎麽用?C# ScintillaControl.MBSafeCharPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ScintillaNet.ScintillaControl的用法示例。


在下文中一共展示了ScintillaControl.MBSafeCharPosition方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetNextDocumentMatch

 /// <summary>
 /// Gets the next valid match but fixes position with selected text's length
 /// </summary>
 public static SearchMatch GetNextDocumentMatch(ScintillaControl sci, List<SearchMatch> matches, Boolean forward, Boolean fixedPosition)
 {
     SearchMatch nearestMatch = matches[0];
     Int32 currentPosition = sci.MBSafeCharPosition(sci.CurrentPos);
     if (fixedPosition) currentPosition -= sci.MBSafeTextLength(sci.SelText);
     for (Int32 i = 0; i < matches.Count; i++)
     {
         if (forward)
         {
             if (currentPosition > matches[matches.Count - 1].Index)
             {
                 return matches[0];
             }
             if (matches[i].Index >= currentPosition)
             {
                 return matches[i];
             }
         }
         else
         {
             if (sci.SelText.Length > 0 && currentPosition <= matches[0].Index + matches[0].Value.Length)
             {
                 return matches[matches.Count - 1];
             }
             if (currentPosition < matches[0].Index + matches[0].Value.Length)
             {
                 return matches[matches.Count - 1];
             }
             if (sci.SelText.Length == 0 && currentPosition == matches[i].Index + matches[i].Value.Length)
             {
                 return matches[i];
             }
             if (matches[i].Index > nearestMatch.Index && matches[i].Index + matches[i].Value.Length < currentPosition)
             {
                 nearestMatch = matches[i];
             }
         }
     }
     return nearestMatch;
 }
開發者ID:xeronith,項目名稱:flashdevelop,代碼行數:43,代碼來源:FRDialogGenerics.cs

示例2: SearchNextNewLineWithoutChar

        private static int SearchNextNewLineWithoutChar(ScintillaControl sender, int position, string text, ref char firstChar)
        {
            char c;
            int safe = sender.MBSafeCharPosition(position);
            int search = safe + text.Length;
               // int pos = 0;
            bool findNewLineBefore = false;
            do
            {

                c = sender.Text[search];
                if(!char.IsWhiteSpace(c)) break;

                if (c == '\n' || c=='\r') findNewLineBefore = true;

                search++;
            } while (true);

            firstChar = c;

            if (findNewLineBefore)
            {
                return 1;
            }

            return 0;
        }
開發者ID:fordream,項目名稱:wanghe-project,代碼行數:27,代碼來源:AutoClose.cs

示例3: GetWordFromPosition

        /// <summary>
        /// Gets a word from the specified position
        /// </summary>
        public static string GetWordFromPosition(ScintillaControl sci,int position, ref int start, ref int end)
        {
            try
            {
                //startPosition = sci.MBSafeCharPosition(sci.WordStartPosition(position, true));
                //endPosition = sci.MBSafeCharPosition(sci.WordEndPosition(position, true));
                //string keyword = sci.Text.Substring(startPosition, endPosition - startPosition);

                start = sci.WordStartPosition(position, true);
                end = sci.WordEndPosition(position, true);
                int startPosition = sci.MBSafeCharPosition(start);
                int endPosition = sci.MBSafeCharPosition(end);

                string keyword = sci.Text.Substring(startPosition, endPosition - startPosition);

                if (keyword.Length==0 || keyword.Equals(" "))  return null;

                //startPosition = sci.WordStartPosition(position, true);
                //endPosition = sci.WordEndPosition(position, true);
                return keyword.Trim();
            }
            catch
            {
                return null;
            }
        }
開發者ID:fordream,項目名稱:wanghe-project,代碼行數:29,代碼來源:Abbreviation.cs

示例4: GetNextDocumentMatch

 public static SearchMatch GetNextDocumentMatch(ScintillaControl sci, List<SearchMatch> matches, int position)
 {
     SearchMatch nearestMatch = matches[0];
     Int32 currentPosition = sci.MBSafeCharPosition(position);
     for (Int32 i = 0; i < matches.Count; i++)
     {
         if (currentPosition > matches[matches.Count - 1].Index)
         {
             return matches[0];
         }
         if (matches[i].Index >= currentPosition)
         {
             return matches[i];
         }
     }
     return nearestMatch;
 }
開發者ID:Dsnoi,項目名稱:flashdevelopjp,代碼行數:17,代碼來源:SaveAsClasses.cs


注:本文中的ScintillaNet.ScintillaControl.MBSafeCharPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。