Mike-Ward.Net

Control.DrawToBitmap Method

A requirement from one of our clients required that I capture an image of a control to a bitmap. Being a Win32 programmer from days gone by I figured no problem. Grab a device context, do some bit blasting and I’m done. It’s a little harder in .Net since you have to do a platform invoke for the BitBlt operation but very doable.

Well wouldn’t you know it, just about the time I finish up the routine I discover that .Net 2.0 has a new method called Control.DrawToBitmap that does this very thing. There are a few restrictions like not working with RichText controls or ActiveX controls. Worked like a charm for me.

← newer older →
.Net, Technology, Life, Whatever

Recent Posts

Quick Tip - Clear ReSharper's Cache to Fix False Errors
Quick Tip - Refined GitHub
Vertical Layout for HTML Tables
Visual Studio 2017 Installer Quick Tip
VSColorOutput for VS 2017 Released
Quick ReSharper tip for inline templates
NoSQL vs. NewSQL: What's the Difference?
More... (1077)

Donate with PayPal