You know when you have a window that is frozen, but when you drag another window over the top it leaves a trail? Sometimes it looks a little bit like the end of Solitaire for Windows 3 🙂 when you get done (like my screenshot).
I’d like to make a C# windows (winforms/wpf) application that creates a surface like this and allows me to capture the image, but I’m a little bit at a loss of where to start.
Picture:

It would be easier with WPF. You can create a
VisualBrushfrom any control, including aWindoworFrameworkElement. Once you have thatVisualBrush, you can paint it all over your form and it will create that same effect. Alternatively, you could use anImageBrushif you want to do it with a picture rather than a UI element.When you paint, just offset it by a couple X/Y each time and it will look just like that as it overwrites (er.. overpaints?) itself!
You can create your own class
FrozenVisualHostthat derives fromFrameworkElementto host aDrawingVisualthat you render. See: MSDN: Using DrawingVisual ObjectsOverriding your
FrozenVisualHost.OnRender()method would allow you to draw your ‘frozen snapshots’ as you recorded mouse movement (viaMouseMove). Just make sure that you call theInvalidateVisual()method to update the host control.One caveat: Creating a
VisualBrushfrom a window will not capture the title bar or window border chrome. If you want that, you’ll have to grab a snapshot manually (GDI): As described here. You can use thatBitmaphowever for yourImageBrushand do rendering similarly.