You are currently browsing the monthly archive for February 2011.

I got a hard time until I (with the help of Google) found out how to create User Controls for the .Net CF and how to integrate these user controls into Visual Studio (with a nice icon in the Toolbox and the right appearance in the Visual Studio Designer). I want to summarize the most important points here… Maybe this helps to save someones time.

1. Create a User Control

First of all start a Smart Device Project in Visual Studio. In the new project you’ll find a User Control which one you can adapt to your needs (adding other controls, painting etc.). You’ll find a lot of tutorials in the net explaining this part.

2. Create a Toolbox Icon

When you include the dll created in Step 1, you’ll find a cog-wheel as Toolbox Icon for your Control. To change this create a 16×16 pixel bitmap (*.bmp) with a color depth of 24 first. Add the bitmap to a folder hierarchy that matches the namespace of your User Control. For instance, your User Control is defined in the namespace, then your folder hierarchy may looks like this:

  • this
    • is
      • my
        • namespace (here goes your Toolbox Icon)

Finally, set the Build Property for the icon to Embedded Resource.

3. Create Design Time Attributes

Add a Design Time Attribute file (*.xmta) file to your project. Add the following code to your file:

<?xml version="1.0" encoding="utf-16"?>
<Class Name="YourNamespace.YourControl">
<Description>Shows some state of a device.</Description>

4. You may need to restart Visual Studio, so it can adapt the changes to the User Control configuration.

If you don’t find your User Control having a nice icon or causing exceptions and error check the following things:

  1. You may add

    to your User Control. When you debug the User Control you should find your bitmap in the array returned by the function having the correct namespace of your User Control mentioned in the file identifier.

  2. Check the project configuration and adapt the Standard Namespace if necessary.
  3. If you use device specific DLLs, don’t forget to surround them by a try-catch-clause, so invocation of DLL functionality does not cause any exceptions when the designer tries to create an object on a form.


PS. Feedback appreciated!

Today, the company’s IT and I wanted to install .Net 3.5 on a workstation. Wondering why it takes so long, I started my favorite search engine and looked for a solution. And after a few clicks, I finally found it…. the network connection. On the company’s network there is a great number of network shares available. Before installation, the .Net installer wants to see all the files in that folders. Because there are a lot of folders with even more files on the network, the better idea was to take of the network cable until the installer finished looking for files on the network shares.

I hope this helps…

Vellocet Club

A blog not only about my time in Sweden and Мiнск but also about the things I am concerned about.

RSS Dinge, die man so liest…

  • An error has occurred; the feed is probably down. Try again later.
February 2011
« Jan   Mar »