Visual.VisualScrollableAreaClip 属性


获取或设置 Visual 的剪辑的可滚动区域。Gets or sets a clipped scrollable area for the Visual.

public:  property Nullable<System::Windows::Rect> VisualScrollableAreaClip {  protected public:
Nullable<System::Windows::Rect> get(); protected:
 void set(Nullable<System::Windows::Rect> value); };
public System.Windows.Rect? VisualScrollableAreaClip { protected internal get; protected set; }
member this.VisualScrollableAreaClip : Nullable<System.Windows.Rect> with get, set
Public Property VisualScrollableAreaClip As Nullable(Of Rect)



一个表示可滚动的剪辑区域的 Rect,如果未分配剪辑区域,则为 nullA Rect that represents the scrollable clipping area, or null if no clipping area is assigned.


设置 VisualScrollableAreaClip 属性,以便在软件中呈现时启用加速滚动。Set the VisualScrollableAreaClip property to enable accelerated scrolling when rendering in software. 这对于远程呈现方案非常有用,例如,通过远程桌面运行或在虚拟机中运行。This is useful in remote rendering scenarios, such as running over Remote Desktop or running in a virtual machine. 在将滚动其子级的父元素上设置此属性。Set this property on the parent element whose children will be scrolled. 在呈现硬件加速时,设置 VisualScrollableAreaClip 属性不起作用。Setting the VisualScrollableAreaClip property has no effect when rendering is hardware accelerated.

VisualScrollableAreaClip 属性启用特定的高级方案。The VisualScrollableAreaClip property enables specific, advanced scenarios. 以下列表显示了使用 VisualScrollableAreaClip 属性时适用的注意事项。The following list shows the caveats that apply when you use the VisualScrollableAreaClip property.

  • 滚动区域的背景必须是不透明的,否则将发生滚动项目。The background of the scrolled area must be opaque, or scrolling artifacts will occur.

  • 仅当 WPF 在软件中呈现时,VisualScrollableAreaClip 属性才会加速滚动。The VisualScrollableAreaClip property accelerates scrolling only when WPF is rendering in software. 例如,当应用程序通过远程桌面运行或在虚拟机中本地运行时,会发生这种情况。For example, this situation occurs when the application is running over Remote Desktop or running locally in a virtual machine.

  • 在硬件中呈现时,滚动行为不变。The scrolling behavior is unchanged when rendering in hardware. 若要防止滚动行为的差异,应保持为硬件和软件启用的 VisualScrollableAreaClip 属性。To prevent differences in scrolling behavior, you should keep the VisualScrollableAreaClip property enabled for both hardware and software.

  • 旋转和倾斜变换禁用加速滚动。Rotate and skew transforms disable accelerated scrolling. 缩放转换和滚动区域上方的水平或垂直翻译工作正常,不会禁用滚动加速。Scale transforms and horizontal or vertical translations above the scrolled region work correctly and do not disable scrolling acceleration.

  • 更改子树或触发可滚动区域的部分以通过动画进行重绘会按预期方式运行,但会丧失重绘区域加速滚动的优点。Changing the subtree or triggering parts of the scrollable area to redraw via animation behave as expected, but lose the benefit of accelerated scrolling for the redrawn area. 在滚动发生的相同帧中使滚动区域失效的任何动画消除了此优化的优点。Any animation that invalidates the scrolled area during the same frame in which scrolling occurs eliminates the benefit of this optimization.

  • VisualScrollableAreaClip 矩形向内对齐到像素。The VisualScrollableAreaClip rectangle snaps inward to pixels. 因此,滚动矩形的已对齐大小始终小于或等于您设置的大小。Therefore, the snapped size of the scrolling rectangle is always less than or equal to the size you have set.

  • 靠下的偏移量。Offsets snap downward. 这意味着,上一个对齐的偏移量和当前对齐的偏移量的差始终为整数的像素数。This means that the difference of the previous snapped offset and current snapped offset is always an integer number of pixels.

  • 命中测试最多可以关闭一个像素。Hit tests can be off by up to a pixel.

  • 应启用布局舍入,因为它可以确保可滚动区域的边缘和边界窗口客户端区域将对齐到像素边界,从而使对齐正确。Layout rounding should be turned on, because it ensures that the edges of scrollable areas and the boundary window client area are snapped to pixel boundaries, resulting in correct alignment.

  • 滚动加速在分层窗口上不起作用。Scrolling acceleration does not work on layered windows. 这意味着 windows 中 AllowTransparency = = true,windowstyle = = none,等等。This means windows in which AllowTransparency == true, window.windowstyle == none, and so on.

  • 滚动加速过程中不会发生滚动加速。Scrolling acceleration does not occur during full-window rendering.

  • 当窗口跨越两台监视器时,滚动加速不起作用。Scrolling acceleration does not work when the window straddles two monitors.

  • 滚动加速在滚动元素的父链中存在中间呈现目标时不起作用。Scrolling acceleration does not work in the presence of intermediate render targets in the parent chain of the scrolled element. 以下列表显示了其中一些中间呈现目标。The following list shows some of these intermediate render targets.

    • ClipsClips

    • 效果Effects

    • DrawingBrushesDrawingBrushes

    • VisualBrushesVisualBrushes

    • OpacityMasksOpacityMasks

    • 不透明度Opacity

  • 每个帧只能发生一次加速滚动。Only one accelerated scroll can happen per frame. 可以有多个加速滚动区域,但其中只有一个可以在框架中执行加速滚动。There can be multiple accelerated scroll areas, but only one of them can perform an accelerated scroll during a frame. 滚动的区域是不确定的。Which area is scrolled is indeterminate.

  • 滚动加速支持滚动区域上方的内容(在 z 顺序中),但不滚动其他内容。Scrolling acceleration supports content above the scrolling region (in z-order) that is not scrolled with the rest of the content. 系统将计算所有必要的脏区域并完成加速滚动,但会通过线路发送多个附加的位图,将无意中滚动的部分移回其在屏幕上的正确位置。The system calculates all necessary dirty regions and completes the accelerated scroll, but it sends several additional bitmaps over the wire to move the unintentionally scrolled portion back to its correct position on screen.