Tagged with .NET

UrlShorteningTextBox

This is something I’ve been meaning to post for a while, but it kept slipping my mind. In Trowl, one of the features is that the “New Tweet” box will automatically shorten any URLs you copy and paste into it. It’s kind of a limited use case — I’m not sure how many apps out there need this ability — but I thought I’d post the code for anyone who might find it useful.

It also demonstrates a few things, like how to capture the “paste” event in .NET, how to create your own events and how to inherit from .NET’s base controls. So even if you don’t use the URL-shortening capability itself, perhaps it can be used for those things.

The code is relatively straightforward, so I’m not going to go through it line-by-line. But I’d be happy to answer any questions — just leave a comment! And, of course, I’m open to any suggestions :)

Enjoy!

UrlShorteningTextBox.cs

Tagged , ,