跟踪控件何时呈现

发布于 2024-12-10 20:26:09 字数 588 浏览 3 评论 0原文

我的最终目标是在特定控件呈现任何更新时绘制更新的 RenderTargetBitmap,这些更新将发送到 COM 对象并在另一个应用程序中呈现。

我试图挂钩任何让我知道该控件或其任何子控件已更新的事件。 我的控件是数据绑定的混合文本和图像字段,以及应用了 ColorAnimations 的渐变。

有什么方法可以知道视觉控件(及其子控件)已更改吗?我尝试过收听 OnVisualChildrenChangedArrangeOverrideParentLayoutInvalidatedOnRender,当渲染数据绑定子项时,它们都不会被触发。

最初的想法是简单地侦听 INotifyPropertyChanged 对象中的数据绑定字段,但是 ColorAnimation 意味着无法正确捕获控件的所有帧。

My end goal is to draw an updated RenderTargetBitmap anytime a specific control renders any updates, which will be sent to a COM object and rendered in another application.

I'm trying to hook onto any event which will let me know that the control, or any of its children, have updated. My control is a mix of databound text and image fields, and gradients that have ColorAnimations applied to them.

Is there any way to know a visual control (and it's children) have changed? I've tried listening to OnVisualChildrenChanged, ArrangeOverride, ParentLayoutInvalidated, and OnRender, none of which are fired when a databound child is rendered.

An initial thought was to simply listen to the databound fields in the INotifyPropertyChanged object, however the ColorAnimation means all the frames of the control won't be properly captured.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

这样的小城市 2024-12-17 20:26:09

您可以“以困难的方式”连接 WPF 使用的 d3d。但由于您正在直接从 C# 代码中寻找一些直接的方法,所以我遇到了一些有趣的事情。

如果我没记错的话,这将让您以一种非常简单的方式连接到 WPF 的 d3d 表面,并让您知道每次渲染表面的时间 - 这样您就只能捕获更新。

http://msdn.microsoft.com/en -us/library/system.windows.media.compositiontarget.rendering.aspx

免责声明:从未尝试过,我上次试用编译器已经是很久以前了-:)

(威尔,谢谢感谢您对 XSplit 测试的贡献)

You could hook into d3d which is used by WPF "the hard way". But since you are looking for some straight forward way directly from your C# code I came across something interesting.

If I am not mistaken this will let you hook into the d3d surface of WPF in a very simple way and let you know every time the surface is rendered – so you can capture only on updates.

http://msdn.microsoft.com/en-us/library/system.windows.media.compositiontarget.rendering.aspx

Disclaimer: Never did try it out and the last time I piloted a compiler is a long time ago-:)

(Will, Thanks for your contributions on XSplit testing)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文