示例#1
0
        /// <summary>
        /// Returns true if the caret is currently positioned at the specified line position.
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        protected bool IsCaretAtLinePosition(LINE_POSITION position)
        {
            _DISPLAY_MOVEUNIT moveUnit;

            if (position == LINE_POSITION.START)
            {
                moveUnit = _DISPLAY_MOVEUNIT.DISPLAY_MOVEUNIT_CurrentLineStart;
            }
            else
            {
                moveUnit = _DISPLAY_MOVEUNIT.DISPLAY_MOVEUNIT_CurrentLineEnd;
            }
            IDisplayServicesRaw displayServices = (IDisplayServicesRaw)HTMLElement.document;
            IDisplayPointerRaw  displayPointer, displayPointer2;

            displayServices.CreateDisplayPointer(out displayPointer);
            displayServices.CreateDisplayPointer(out displayPointer2);
            IHTMLCaretRaw caret = GetCaret();

            caret.MoveDisplayPointerToCaret(displayPointer);
            displayPointer2.MoveToPointer(displayPointer);
            displayPointer2.MoveUnit(moveUnit, -1);
            bool areEqual;

            displayPointer2.IsEqualTo(displayPointer, out areEqual);
            return(areEqual);
        }
 /// <summary>
 /// Returns true if the caret is currently positioned at the specified line position.
 /// </summary>
 /// <param name="position"></param>
 /// <returns></returns>
 protected bool IsCaretAtLinePosition(LINE_POSITION position)
 {
     _DISPLAY_MOVEUNIT moveUnit;
     if (position == LINE_POSITION.START)
         moveUnit = _DISPLAY_MOVEUNIT.DISPLAY_MOVEUNIT_CurrentLineStart;
     else
         moveUnit = _DISPLAY_MOVEUNIT.DISPLAY_MOVEUNIT_CurrentLineEnd;
     IDisplayServicesRaw displayServices = (IDisplayServicesRaw)HTMLElement.document;
     IDisplayPointerRaw displayPointer, displayPointer2;
     displayServices.CreateDisplayPointer(out displayPointer);
     displayServices.CreateDisplayPointer(out displayPointer2);
     IHTMLCaretRaw caret = GetCaret();
     caret.MoveDisplayPointerToCaret(displayPointer);
     displayPointer2.MoveToPointer(displayPointer);
     displayPointer2.MoveUnit(moveUnit, -1);
     bool areEqual;
     displayPointer2.IsEqualTo(displayPointer, out areEqual);
     return areEqual;
 }