macraee
macraee

Reputation: 75

Changing Column Height for ListView Column

With reference to my previous question here: Changing Font Size for ListView Column in C#. I would like to know how to change the height of the column within a listView with OwnerDraw enabled.

I have succeeded in changing the font using the following code.

        using (Font headerFont =
                new Font("Helvetica", 10, FontStyle.Bold)) //Font size!!!!
    {
        e.Graphics.DrawString(e.Header.Text, headerFont,
            Brushes.Black, e.Bounds, sf);
    }

Although I cannot change the size of the column, giving it a cut-off effect. I have been playing around with the Rectangle.Bounds property but this appears to be read only.

Any suggestions?

Thanks

Upvotes: 2

Views: 3234

Answers (2)

Libor
Libor

Reputation: 3303

You can try Better ListView Express. It allows changing column header height to arbitrary sizes. It is also free and the usage is 99% same as ListView.

Upvotes: 0

macraee
macraee

Reputation: 75

I have decided to take an alternative approach for my application. I chose to remove the header altogether and replace it with labels within a Container Panel.

This was achieved by changing the HeaderStyle property of the listView to "None". The result allowed me to dock the labels to the top of my listView, giving me the larger text I've been after!

Granted this is a little different to the question asked but provides a simple solution to what appears to be a complex problem! Additionally this would make the column headers static so may not be useful for developing applications requiring numerous changes

Thanks for all your help, and let me know if you would like more detail

Euan

Upvotes: 1

Related Questions