Archive for the ‘.Net’ Category

Putting formatted text on the clipboard

Working with the Windows clipboard in managed code is both easy and hard. It’s easy because all you need to do in order to put a bit of text on the clipboard is this:
Clipboard.SetText("Put this on the clipboard");

It’s hard because you can’t just do something like this in order to get formatted text:

Clipboard.SetHtml(‘<a href="http://twwilliams.com/>A link</a>"’);

The [...]

How to change your screen resolution using C#

My laptop gets confused when it goes in or comes out of the docking station and always picks the wrong resolution for the monitor. Part of this might be due to a difference in aspect ratios: the laptop screen is a widescreen model (width:height is 4:3) while the monitor connected to the docking station is [...]