in3steps.com Articles   Languages   Authors   Affiliate   Search   About us
Creating inherited .NET components in C#  •  Cosmetics

Our component works well, but looks not so presentable. It appears as a standart gear wheel in toolbox, the build authorshop isn't declared, there's no any documentaion. This should be fought. Let's begin from documentation.

Open in3steps project properties (double click on corresponding element in Solution Explorer) and turn on XML documentation file on the Build tab. It's better to leave the name and path of XML-file with their default value  - let them be in the same place with DLL of the build. Then, go to the first declaration in our DialogButton.cs file, find first public declaration (in our case, it's a DialogButton class declaration), place cursor on the line above the declaration and three times press slash. The environment creates a description template and polirtly places cursor in a right place. Type rhe description, go down, and do the same thing for GetText, CharCase, for entire type and for every constant separately (remember, we put them on individual lines?) and so on till the end of the file, attending every public description, If we'll forget something, the environment will remind us about all undocumented places in time of compilation. After successful compilation, all our data is stored in XML, which is in the same folder with build file. It's possible to make a CHM from this XML, but it is very very difficult, so it's a subject for another story. But I hope, that I will be able to show an easy way from XML to CHM.

So, documenting is over. Technically, component is fully completed. It works and it's documented. Only cosmetics remained. Let's begin from filling up of build data. Open Properties of in3steps project and double click on AssemblyInfo.cs. In editor change everythihg, that we want, and get something like this:

[assembly: AssemblyTitle("in3steps")]
[assembly: AssemblyDescription("in3steps Example Assembly")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("greatis just4fun network & in3steps")]
[assembly: AssemblyProduct("DialogButton")]
[assembly: AssemblyCopyright("Copyright © 2008 in3steps.com")]
[assembly: AssemblyTrademark("in3steps")]
[assembly: AssemblyCulture("")]

It would be nice to give information to programmers, a people, who first look in sources and then rarely to documentation. Add comments to the beginning of DialogButton.cs. We, at the Greatis Software, usually do it this way:

/*  Creating Inherited C# Control Example
 *  Copyright (c) 2008 in3steps
 *  http://InheritedCSharpControl.in3steps.com/
 */

Now, it's time for dessert. We need to replace crude blue gear wheel, that is used by default for our new component, with something, that will slightly hint at functionality of our button. Most logical solution is to take standart Button icon and gently modify it. I didn't find nothing better, then to replace "ab" caption with "OK" (anyway, it's too small to hold anything more) and make this caption bright red, to try to show, that this caption is not standard, but automatic. Save this picture in DialogButton.bmp. Don't forget, that color of left bottom pixel is used to determine transparency color. Add this picture to in3steps project (Right click - Add - Existing item...), right click on added picture, choose Properties and set value Embedded Resource for BuildAction. Go to DialogButton.cs and put ToolboxBitmap(typeof(DialogButton)) attribute before DialogButton class declaration. Rebuild whole solution. That's all! :)

 • justaman, Pluto  • 

Home  •  Previous step  •  Download sample code  •  Russian


See also
Greatis Software
MegaDetailed.NET
Search for more →
 

greatis just4fun network