共用方式為


IViewScroller Interface

Represents a helper class for the ITextView, and provides basic functionality for scrolling. The ViewScroller property of ITextView is used to get an instance of the this interface.

Namespace:  Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Syntax

'宣告
Public Interface IViewScroller
public interface IViewScroller
public interface class IViewScroller
type IViewScroller =  interface end
public interface IViewScroller

The IViewScroller type exposes the following members.

Methods

  Name Description
Public method EnsureSpanVisible(SnapshotSpan) Ensures that all the text in the specified span is entirely visible in the view.
Public method EnsureSpanVisible(SnapshotSpan, EnsureSpanVisibleOptions) Ensures that all the text in the specified span is entirely visible in the view.
Public method EnsureSpanVisible(VirtualSnapshotSpan, EnsureSpanVisibleOptions) Ensures that all the text in the specified span is entirely visible in the view.
Public method ScrollViewportHorizontallyByPixels Scrolls the viewport horizontally by the specified distance.
Public method ScrollViewportVerticallyByLine Scrolls the viewport vertically one line up or down.
Public method ScrollViewportVerticallyByLines Scrolls the viewport vertically by multiple lines up or down.
Public method ScrollViewportVerticallyByPage Scrolls the viewport vertically one page up or down.
Public method ScrollViewportVerticallyByPixels Scrolls the viewport vertically by the specified distance.

Top

Remarks

Most properties and parameters that are doubles correspond to coordinates or distances in the text rendering coordinate system. In this coordinate system, x = 0.0 corresponds to the left edge of the drawing surface onto which text is rendered (x = view.ViewportLeft corresponds to the left edge of the viewport), and y = view.ViewportTop corresponds to the top edge of the viewport. The x-coordinate increases from left to right, and the y-coordinate increases from top to bottom. The horizontal and vertical axes of the view behave differently. When the text in the view is formatted, only the visible lines are formatted. As a result, a viewport cannot be scrolled horizontally and vertically in the same way .A viewport is scrolled horizontally by changing the left coordinate of the viewport so that it moves with respect to the drawing surface. A view can be scrolled vertically only by performing a new layout. Doing a layout in the view may cause the ViewportTop property to change.

For example, scrolling down one line will not translate any of the visible lines. Instead it will simply change the ViewportTop property (causing the lines to move on the screen even though their y-coordinates have not changed). Distances in the text rendering coordinate system correspond to logical pixels. If the text rendering surface is displayed without any scaling transform, then 1 unit in the text rendering coordinate system corresponds to one pixel on the display.

See Also

Reference

Microsoft.VisualStudio.Text.Editor Namespace