Thursday, March 24, 2011

DataGridView/ListView - Display in an Outlook style?

Hello all,

I'm used to using Telerik Grids and I'm able to display them in an outlook style, i.e. a picture on the far left, a bold title and a few other lines of text under the main title.

Is there a way do this using a standard .Net2.0 Windows control? Either with a cheap control, or the existing datagridview or listview?

Basically, I need to be able to produce a layout as follows:

Job Title
Engineer: Fred Bloggs
Product: Some random product

So, I'll have 2000 or so of these items in a grid with a status image next to each of them, what's the best way to achieve this?

From stackoverflow
  • I can't give you an example as I don't have time to write it at this time, but you could create a UserControl which lays out the row as you would like to see it. Then you would have to create your own DataGridViewCell which can handle a UserControl rather than the standard cell types which MS provides. For each of your entries, create and fill the user control and add it to another row in the DataGridView.

  • Here is help with using a listview for the list. I would go with the list because you will only have one column, so no need for the grid.

    You want to use :

    private void lstItems_DrawItem(object sender, DrawItemEventArgs e)
    

    Then use the e.Graphics to get an object you can draw directly to.

    I used this tutorial to help me learn about drawing in the ListView

  • I've been looking for the same thing. I just came across something interesting. Check out the free Visual Basic Power Packs 3.0 (you can reference this from any .NET language including c#):

    http://msdn.microsoft.com/en-us/vbasic/bb735936.aspx

    It basically let's you design a single row with whatever controls you want and then repeats that row with your bound data

0 comments:

Post a Comment