We investigated this problem further and found a simple solution. It does not require to write code for licensing non-Windows Forms applications.
We created a new "Open Source & Articles" section on our website, where this topic is covered by a detailed article. The link is:
http://www.idealsoftware.com/opensource/net-licensing.html. You'll also find a permanent link to this new section on the top-left side of our website.
Solution in short:
When you place a .NET Windows Forms component onto a form, the Visual Studio IDE adds automatically a 'licenses.licx' file to your project. This file is required to license the used components during the runtime of your application. The file does not contain any license keys, but information about the used components.
If WPF is used, or the component is used in a windowless application - for example a Windows Service - you need to add the 'licenses.licx' file manually to the 'Properties' section of your solution.For our product Virtual Print Engine you can simply copy the 'licenses.licx' file from one of our sample projects, which are installed with VPE, to the directory of your application and add it to your solution.
For completeness, the article does also contain downloadable source code, which demonstrates how to solve this problem programmatically. We developed this code to make sure we didn't tell anything wrong.
But using a licx-file is the preferred and simpler way.