当前位置: 首页>>代码示例>>C#>>正文


C# ITextPointer类代码示例

本文整理汇总了C#中ITextPointer的典型用法代码示例。如果您正苦于以下问题:C# ITextPointer类的具体用法?C# ITextPointer怎么用?C# ITextPointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITextPointer类属于命名空间,在下文中一共展示了ITextPointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TextParentUndoUnit

        internal TextParentUndoUnit(ITextSelection selection, ITextPointer anchorPosition, ITextPointer movingPosition)
            : base(String.Empty)
        {
            _selection = selection;

            _undoAnchorPositionOffset = anchorPosition.Offset;
            _undoAnchorPositionDirection = anchorPosition.LogicalDirection;
            _undoMovingPositionOffset = movingPosition.Offset;
            _undoMovingPositionDirection = movingPosition.LogicalDirection;

            // Bug 1706768: we are seeing unitialized values when the undo
            // undo is pulled off the undo stack. _redoAnchorPositionOffset
            // and _redoMovingPositionOffset are supposed to be initialized
            // with calls to RecordRedoSelectionState before that happens.
            //
            // This code path is being left enabled in DEBUG to help track down
            // the underlying bug post V1.
#if DEBUG
            _redoAnchorPositionOffset = -1;
            _redoMovingPositionOffset = -1;
#else
            _redoAnchorPositionOffset = 0;
            _redoMovingPositionOffset = 0;
#endif
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:25,代码来源:TextParentUndoUnit.cs

示例2: FireChangedEvent

 // Raises a Changed event for any listeners, covering the
 // specified text.
 internal void FireChangedEvent(ITextPointer start, ITextPointer end)
 {
     if (Changed != null)
     {
         Changed(this, new SpellerHighlightChangedEventArgs(start, end));
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:SpellerHighlightLayer.cs

示例3: DocumentSequenceTextPointer

 //------------------------------------------------------
 //
 //  Constructors
 //
 //------------------------------------------------------
 #region Constructors
 // Ctor always set mutable flag to false
 internal DocumentSequenceTextPointer(ChildDocumentBlock childBlock, ITextPointer childPosition)
 {
     Debug.Assert(childBlock != null);
     Debug.Assert(childPosition != null);
     _childBlock = childBlock;
     _childTp = childPosition;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:documentsequencetextpointer.cs

示例4: SpellerStatusTable

        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        // Constructor.
        internal SpellerStatusTable(ITextPointer textContainerStart, SpellerHighlightLayer highlightLayer)
        {
            _highlightLayer = highlightLayer;

            _runList = new ArrayList(1);

            _runList.Add(new Run(textContainerStart, RunType.Dirty));
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:17,代码来源:SpellerStatusTable.cs

示例5: SpellingError

        //-----------------------------------------------------
        //
        //  Constructors 
        //
        //----------------------------------------------------- 
 
        #region Constructors
 
        // Creates a new instance.
        internal SpellingError(Speller speller, ITextPointer start, ITextPointer end)
        {
            Invariant.Assert(start.CompareTo(end) < 0); 

            _speller = speller; 
            _start = start.GetFrozenPointer(LogicalDirection.Forward); 
            _end = end.GetFrozenPointer(LogicalDirection.Backward);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:17,代码来源:SpellerError.cs

示例6: TextContainerChangeEventArgs

 internal TextContainerChangeEventArgs(ITextPointer textPosition, int count, int charCount, TextChangeType textChange, DependencyProperty property, bool affectsRenderOnly) 
 {
     _textPosition = textPosition.GetFrozenPointer(LogicalDirection.Forward); 
     _count = count; 
     _charCount = charCount;
     _textChange = textChange; 
     _property = property;
     _affectsRenderOnly = affectsRenderOnly;
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:9,代码来源:TextContainerChangeEventArgs.cs

示例7: VerifyPosition

        // Verifies a TextPointer is non-null and is associated with a given TextContainer.
        //
        // Throws an appropriate exception if a test fails.
        internal static void VerifyPosition(ITextContainer container, ITextPointer position, string paramName)
        {
            if (position == null)
            {
                throw new ArgumentNullException(paramName);
            }

            if (position.TextContainer != container)
            {
                throw new ArgumentException(SR.Get(SRID.NotInAssociatedTree, paramName));
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:15,代码来源:ValidationHelper.cs

示例8: GetRectangleFromTextPosition

 /// <summary> 
 /// <see cref="ITextView.GetRectangleFromTextPosition"/>
 /// </summary> 
 /// <remarks> 
 /// Calls GetRawRectangleFromTextPosition to get a rect and a transform, and applies the transform to the
 /// rect. 
 /// </remarks>
 internal virtual Rect GetRectangleFromTextPosition(ITextPointer position)
 {
     Transform transform; 
     Rect rect = GetRawRectangleFromTextPosition(position, out transform);
     // Transform must not be null. TextViews returning no transform should return identity 
     Invariant.Assert(transform != null); 
     if (rect != Rect.Empty)
     { 
         rect = transform.TransformBounds(rect);
     }
     return rect;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:19,代码来源:TextViewBase.cs

示例9: GetTextInRun

        // Worker for GetText, accepts any ITextPointer.
        internal static string GetTextInRun(ITextPointer position, LogicalDirection direction)
        {
            char[] text;
            int textLength;
            int getTextLength;

            textLength = position.GetTextRunLength(direction);
            text = new char[textLength];

            getTextLength = position.GetTextInRun(direction, text, 0, textLength);
            Invariant.Assert(getTextLength == textLength, "textLengths returned from GetTextRunLength and GetTextInRun are innconsistent");

            return new string(text);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:TextPointerBase.cs

示例10: TextRange

        // ignoreTextUnitBoundaries - true if normalization should ignore text
        // normalization (surrogates, combining marks, etc).
        // Used for fine-grained control by IMEs.
        internal TextRange(ITextPointer position1, ITextPointer position2, bool ignoreTextUnitBoundaries)
        {
            if (position1 == null)
            {
                throw new ArgumentNullException("position1");
            }
            if (position2 == null)
            {
                throw new ArgumentNullException("position2");
            }

            SetFlags(ignoreTextUnitBoundaries, Flags.IgnoreTextUnitBoundaries);

            ValidationHelper.VerifyPosition(position1.TextContainer, position1, "position1");
            ValidationHelper.VerifyPosition(position1.TextContainer, position2, "position2");

            TextRangeBase.Select(this, position1, position2);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:21,代码来源:TextRange.cs

示例11: TextSegment

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="startPosition">
        /// Position preceeding the TextSegment's content.
        /// </param>
        /// <param name="endPosition">
        /// Position following the TextSegment's content.
        /// </param>
        /// <param name="preserveLogicalDirection">
        /// Whether preserves LogicalDirection of start and end positions.
        /// </param>
        internal TextSegment(ITextPointer startPosition, ITextPointer endPosition, bool preserveLogicalDirection)
        {
            ValidationHelper.VerifyPositionPair(startPosition, endPosition);

            if (startPosition.CompareTo(endPosition) == 0)
            {
                // To preserve segment emptiness
                // we use the same instance of a pointer
                // for both segment ends.
                _start = startPosition.GetFrozenPointer(startPosition.LogicalDirection);
                _end = _start;
            }
            else
            {
                Invariant.Assert(startPosition.CompareTo(endPosition) < 0);
                _start = startPosition.GetFrozenPointer(preserveLogicalDirection ? startPosition.LogicalDirection : LogicalDirection.Backward);
                _end = endPosition.GetFrozenPointer(preserveLogicalDirection ? endPosition.LogicalDirection : LogicalDirection.Forward);
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:31,代码来源:TextSegment.cs

示例12: VerifyPositionPair

 // Verifies two positions are safe to use as a logical text span.
 //
 // Throws ArgumentNullException if startPosition == null || endPosition == null
 //        ArgumentException if startPosition.TextContainer != endPosition.TextContainer or
 //                             startPosition > endPosition
 internal static void VerifyPositionPair(ITextPointer startPosition, ITextPointer endPosition)
 {
     if (startPosition == null)
     {
         throw new ArgumentNullException("startPosition");
     }
     if (endPosition == null)
     {
         throw new ArgumentNullException("endPosition");
     }
     if (startPosition.TextContainer != endPosition.TextContainer)
     {
         throw new ArgumentException(SR.Get(SRID.InDifferentTextContainers, "startPosition", "endPosition"));
     }
     if (startPosition.CompareTo(endPosition) > 0)
     {
         throw new ArgumentException(SR.Get(SRID.BadTextPositionOrder, "startPosition", "endPosition"));
     }
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:24,代码来源:ValidationHelper.cs

示例13: GetTextWithLimit

        // Like GetText, excepts also accepts a limit parameter -- no text is returned past
        // this second position.
        // limit may be null, in which case it is ignored.
        internal static int GetTextWithLimit(ITextPointer thisPointer, LogicalDirection direction, char[] textBuffer, int startIndex, int count, ITextPointer limit)
        {
            int charsCopied;

            if (limit == null)
            {
                // No limit, just call GetText.
                charsCopied = thisPointer.GetTextInRun(direction, textBuffer, startIndex, count);
            }
            else if (direction == LogicalDirection.Forward && limit.CompareTo(thisPointer) <= 0)
            {
                // Limit completely blocks the read.
                charsCopied = 0;
            }
            else if (direction == LogicalDirection.Backward && limit.CompareTo(thisPointer) >= 0)
            {
                // Limit completely blocks the read.
                charsCopied = 0;
            }
            else
            {
                int maxCount;

                // Get an upper bound on the amount of text to copy.
                // Since GetText always stops on non-text boundaries, it's
                // ok if the count too high, it will get truncated anyways.
                if (direction == LogicalDirection.Forward)
                {
                    maxCount = Math.Min(count, thisPointer.GetOffsetToPosition(limit));
                }
                else
                {
                    maxCount = Math.Min(count, limit.GetOffsetToPosition(thisPointer));
                }
                maxCount = Math.Min(count, maxCount);

                charsCopied = thisPointer.GetTextInRun(direction, textBuffer, startIndex, maxCount);
            }

            return charsCopied;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:44,代码来源:TextPointerBase.cs

示例14: Apply

        /// <summary>
        ///   Apply the display attribute to to the given range.
        /// </summary>
        internal void Apply(ITextPointer start, ITextPointer end)
        {
            //
            // 


             
#if NOT_YET
            if (_attr.crText.type != UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_NONE)
            {
            }

            if (_attr.crBk.type != UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_NONE)
            {
            }

            if (_attr.lsStyle != UnsafeNativeMethods.TF_DA_LINESTYLE.TF_LS_NONE)
            {
            }
#endif

        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:TextServicesDisplayAttribute.cs

示例15: if

        /// <summary>
        /// Compares this TextPointer with another TextPointer.
        /// </summary>
        /// <param name="position">
        /// The TextPointer to compare with.
        /// </param>
        /// <returns>
        /// Less than zero: this TextPointer preceeds position.
        /// Zero: this TextPointer is at the same location as position.
        /// Greater than zero: this TextPointer follows position.
        /// </returns>
        int ITextPointer.CompareTo(ITextPointer position)
        {
            int offset;
            int result;

            offset = ((PasswordTextPointer)position)._offset;

            if (_offset < offset)
            {
                result = -1;
            }
            else if (_offset > offset)
            {
                result = +1;
            }
            else
            {
                result = 0;
            }

            return result;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:33,代码来源:PasswordTextNavigator.cs


注:本文中的ITextPointer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。