Click here to Skip to main content
15,881,812 members
Articles / Programming Languages / C#
Article

C# control library

Rate me:
Please Sign up or sign in to vote.
1.00/5 (10 votes)
23 Feb 20062 min read 39.1K   812   13   2
A few controls: ImageListBox, ImageComboBox, ColorComboBox, UpDown, OutputWindow, and PickList

Introduction

Over the 2005-2006 holiday season, I got a kick out of developing some C# controls. I had more time to fix them up a bit, stick them in a DLL and demo project. I plan on extending them.

Output Window and Color Combobox Control

Sample screenshotThe Output Window is a simple control that basially inherits from RichEditBox. I got the idea from Visual Make tool.

The control has like three main member functions/properties: OutputText(string), OutputText(string, Color), and TextColor.

The color combobox shows all the known colors and allows the user to see the color selected as well as the name. Setting the DropDownStyle to ComboBoxStyle.DropDownList allows for the neat display, else it will just show the selected text.

The demo dialog lets you see how the controls are used.

 

 

ImageListBox and ImageCombobox

Sample screenshot

This demos the ability to show images in the listitem. The controls use a DataTable to store the image and text. Future versions should allow an ItemData field which would not be visible. It would also be easy to do multiple columns.

On the Combobox, notice the DropDownStyle.

UpDown

Sample screenshot 

This is a simple UpDown control I threw in with the intention of using it for future controls.

PickList

Sample screenshot

The Picklist uses two ImageList controls above. The demo shows that multiple copies of the same image can be added. This and the fact the images are physically moved from one listbox to the other may be a huge performance issue. Re redesign where the images are maintained in a single ImageList would be better. For my purposes, this implementation works well.

History<o:p>

See my site for a listing of controls and the code. I wanted to get the code out so others can use them, extend them, and pass them on. The initial design used a ImageList to store the images and the table for the key and text. I didn't like that design because (as shown in the demo) I wanted to be able to pass the DataTable to other controls.

To include the control with out building a library DLL, just include the file, for example, ImageListBox.cs to the project. Compiling it will temporarily add the control to the toolbox so it can be dragged and dropped onto the form. <o:p>

Eventually, I want to make a multi-column combobox/listbox. The way the ImageComboBox is designed (using the DataSet) it seems fairly easy to extend. I'm sure there are easier or better ways.. that is why I submit the code to the gurus of the world. Someone out there can use all this I'm sure. And for others? They can use it to go on to better controls. <o:p>

Anyway, I also want to extend the library into a more robust one. Unfortunately I have more interests than time permits. <o:p>

Enjoy!<o:p>

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer
United States United States
I enjoy messing with application development and some Web development technologies. Right now I work in Virginia as a contractor to the government.

I am a Microsoft Cert. Professional and I got my 4 year BS degree.

See web site for resume and other code samples.

Comments and Discussions

 
GeneralMmmmmm... Pin
[Marc]14-Jan-06 2:30
[Marc]14-Jan-06 2:30 
GeneralRe: Mmmmmm... Pin
MJDamron23-Feb-06 3:51
MJDamron23-Feb-06 3:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.