Tips

Class Diagrams as Documentation

customer.png
customer.png

The Class Diagram tooling built into Visual Studio is worth its weight in gold as documentation.

What I didn't know, and discovered today, is that using Copy Image populates the clipboard with not only a raster version of the image, but a vector version as well. Fantastic for embedding into Word documents when writing documentation.

Strange Win.Forms behaviour

Here’s a strange piece of behaviour – a puzzle (with a solution) for you.

Imagine that you’re working with Win.Forms, constructing a resizable layout using a TableLayoutForm as the host.

Using Lambdas as Event Handlers

Of all the new features in C# 3.0, Lambda expressions have to be one of my favourites.

One non-obvious way that they can be used is as event handlers, in just the way that anonymous delegates could be.

Margin Guides in Visual Studio

To set a margin guide in Visual Studio requires a minor Registry Hack (*)

First, use RegEdit to go to the key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor.

RegEdit Screenshot
RegEdit Screenshot

Next, create a new string value "Guides" with value "RGB(128,128,128) 99" (sans quotes). This creates a gray guideline just after the 99th column.

Change RBGB(r,g,b) to change the colour of the guide; you can create multiple guides by separating them with commas at the end.

(*) Usual warnings apply - stuff up your Registry and your machine is hosed. Take precautions.

Finding Configuration Files

Here’s a useful technique for finding the location of configuration files.

Each AppDomain has a base directory from which it loads assemblies – when you double click a WinForms or WPF application, the new process that starts up has an AppDomain whose base directory is the directory in which your exe is located.

Syndicate content