Tag Archives: ListView

Print a ListView control’s contents on multiple pages in C#

This example continues the following two examples: Print a ListView with large contents in C# Print the contents of a ListView control in C# Read those examples for an overview of the basic procedure. This example prints the contents of … Continue reading

Posted in controls, extension methods, printing | Tagged , , , , , , , , , , , , , | 4 Comments

Print a ListView with large contents in C#

The example Print the contents of a ListView control in C# explains how to print the data in a ListView control when its View property is set to Details. One difficulty when printing this kind of data is that a … Continue reading

Posted in controls, drawing, graphics, printing | Tagged , , , , , , , , , , , , , , | Leave a comment

Print the contents of a ListView control in C#

The ListView control, like most controls, includes no support for printing. If you want to display a ListView control’s contents on a print out, you need to do all of the printing yourself. Unfortunately printing in C# is extremely flexible … Continue reading

Posted in controls, drawing, graphics, printing | Tagged , , , , , , , , , , , , | 24 Comments

Sort ListView controls by all columns or clicked columns in C#

The ListView control provides features to sort its values but by default it doesn’t use them. This example shows how you can add extension methods to the control to make it sort on all columns or on clicked columns. This … Continue reading

Posted in controls, extension methods | Tagged , , , , , , , , , , , , | 1 Comment

Make an OwnerDraw ListView in C#

Normally a ListView displays textual data, but you can change that behavior to make it display anything that you can draw. This example draws images and colored circles to show the status of fictional servers. The idea is to set … Continue reading

Posted in controls, drawing, graphics, user interface | Tagged , , , , , , , , , , , , , , , , | 1 Comment

Sort a ListView using the column you click in C#

You can sort a ListView using the column you click, but it’s a lot more work than simply sorting the ListView‘s items. To sort using the items, you can simply set the control’s Sorting property to Ascending or Descending. Unfortunately, … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , | 7 Comments

Sort a ListView control using all of its columns in C#

You can make the ListView sort by setting its Sorting property to Ascending or Descending, but it takes some extra work to sort a ListView control using all of its columns. Normally the control only sorts on its items, not … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , | Leave a comment

Find the ListView row and column under the mouse in C#

This example shows you the ListView row and column under the mouse when the mouse moves over the ListView control. (You could modify the program to display the row and column when you click on the control instead of just … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , | 2 Comments

Easily add column headers and items to a ListView control in C#

Normally to add a row to a ListView control, you first add a new item and then add sub-items to the item. The following code shows an AddRow extension method for the ListView class that makes adding new rows easier. … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , | 1 Comment

Automatically resize ListView columns to fit their data in C#

It’s actually pretty easy to automatically resize ListView columns to fit their data. If you set a ListView column’s width to -1, it automatically resizes to fit the data it contains. If you set the width to -2, it resizes … Continue reading

Posted in controls | Tagged , , , , , , , , | 1 Comment