This is my first article, so please do not be hard on me . The purpose was to make the base of a data viewing control like the one found in Microsoft's applications, or the one proposed by the "magic controls". So the main goal was the looks defined by looks and a basic functionality.
The main idea
The main idea was to extend a
ListView, and work with its properties. Customize it to show only lists, inhibit read only to
false, and full row select to
true. Also, make it possible for a data source, just add a new object into the control to hold the data and make some functions to process the given data source. Make a row in the control for any row in the data source... Implement some properties for the control to be functional, properties like:
Nothing hard ... except the interception of an row drawing event. Here is the big problem, if you want a nicer drawing. So the code must intercept the draw item message and process it custom. In order to intercept this you must set the control style so that the desired message to be passed to you and not be default handled.
For the control to be useful, I had to implement some rudimentary table styles ... if it can be named so . There are some functions made to make it all possible in an easy code snippet.
The control is easy to use, like the
DataSet dataSet = new DataSet();
DataListView dataListView = new DataListView();
dataListView.DataSource = dataSet; dataListView.DataMember = "TableNameInDataSet";
Instead of ending
The code is not meant to be "the best", it is easy to understand and can be heavily improved in all ways. I end this article with my usual statement : "I hope you understand...".
Anyway if you like my idea and you ever decide to use my control, you are free to modify it as you wish, but you can mention me somewhere there on the about window